... sorts either a list or a vector using the same command?
The easiest way is to overload:
template <typename T>
inline void sort(std::vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T>
inline void sort(std::list<T>& x) { x.sort(); }
UPDATE
You mean that your text has not yet entered patterns, so here is an alternative without patterns. The question says that "differs only in type declaration for the data structure that contains the input file," and we are talking about vectorand list, therefore, there should be something like:
std::vector<std::string> input;
, std::string - , , , , vector list, typedef, ala input::element_type. , , vector list :
inline void sort(std::vector<input::element_type>& x) { std::sort(x.begin(), x.end()); }
inline void sort(std::list<input::element_type>& x) { x.sort(); }
, hardcode std::string , - , , .
inline void sort(std::vector<std::string>& x) { std::sort(x.begin(), x.end()); }
inline void sort(std::list<std::string>& x) { x.sort(); }