Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <iterator>
- #include <tuple>
- using test_tuple_type = std::tuple<int, int, std::string>;
- std::ostream& operator<<(std::ostream& out, const test_tuple_type& value)
- {
- out << std::get<2>(value) << ',' << std::get<0>(value) << ',' << std::get<1>(value);
- return out;
- }
- template <typename TCont>
- void print(const TCont& s, std::string delim = " ")
- {
- std::copy(s.begin(), s.end(), std::ostream_iterator<typename TCont::value_type>(std::cout, delim.c_str()));
- std::cout << std::endl;
- }
- int main()
- {
- std::vector<test_tuple_type> v = {
- {1, 2, "hop"},
- {3, 4, "hey"},
- {5, 6, "la-la-ley"},
- };
- print(v);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement