#ifndef TYPES_H_ #define TYPES_H_ 1 // Oldham, Jeffrey D. // 2000 Jan 25 // CS1321 // CS1321 Homework 3: Type Definitions #include #include // has pair #include #include // Represent each document as a name and a vector of doubles. typedef std::pair > DocVec; // Given a DocVec variable dv, // to obtain the name, use "dv.first". This has type "string". // to obtain the vector, use "dv.second". This has type "vector". // Each document's score is stored as its name and its score. typedef std::pair DocScore; // Given a DocScore variable ds, // to obtain the name, use "ds.first". This has type "string". // to obtain the score, use "ds.second". This has type "double". // My code needs a mapping from document words to positions within a // vector. typedef std::hash_map::size_type> KeywordMapping; // our hash function // Caveat reader! __STL_TEMPLATE_NULL struct hash { size_t operator()(string __s) const { return __stl_hash_string(__s.c_str()); } }; #endif // TYPES_H_