diff --git a/ch17/ex17.3/textquery.cpp b/ch17/ex17.3/textquery.cpp index 16b337f4..e255ea2b 100644 --- a/ch17/ex17.3/textquery.cpp +++ b/ch17/ex17.3/textquery.cpp @@ -81,10 +81,7 @@ TextQuery::query(const std::string &sought) const /** * @brief do a query opertion and return tuple. */ -std::tuple>, - std::shared_ptr>> - TextQuery::query_return_tuple(const std::string &sought) +result_tuple TextQuery::query_return_tuple(const std::string &sought) { //! dynamicaly allocated set used for the word does not appear. static std::shared_ptr> noData(new std::set); @@ -93,15 +90,8 @@ std::tuple>>::const_iterator auto iter = wm.find(sought); if(iter == wm.end()) - return std::tuple >, - std::shared_ptr>> - (sought, noData, file); + return result_tuple(sought, noData, file); else - return std::tuple >, - std::shared_ptr>> - (sought, iter->second, file); - + return result_tuple(sought, iter->second, file); } diff --git a/ch17/ex17.3/textquery.h b/ch17/ex17.3/textquery.h index 26dfba93..38f660b4 100644 --- a/ch17/ex17.3/textquery.h +++ b/ch17/ex17.3/textquery.h @@ -22,6 +22,9 @@ class TextQuery public: typedef std::vector::size_type index_Tp; + typedef std::tuple >, + std::shared_ptr>> result_tuple; //! constructor TextQuery(std::ifstream&); @@ -31,10 +34,7 @@ class TextQuery query(const std::string&) const; //! query operation returns tuple - std::tuple >, - std::shared_ptr>> - query_return_tuple(const std::string& sought); + result_tuple query_return_tuple(const std::string& sought); private: std::shared_ptr> file; std::map