
6 Aug
2012
6 Aug
'12
12:21 p.m.
AMDG On 08/06/2012 02:55 AM, Paul A. Bristow wrote:
template <typename K, typename T> std::ostream& operator<< (std::ostream& os, std::pair<K, T>& p) { /*! Output a pair of values. \details For example: "1.23 , 3.45". */ os << p.first << ", " << p.second; return os; }
And I can echo the input as expected
1, 9.9000 2, 8.8000
but when I try to use the sequence printer
p2.print(std::cout, my_map);
the compiler (VC10) complains the there is no operator<<
Yep. It can't be found by ADL unless it's declared in namespace std, which is forbidden. You can solve this by specializing boost::type_erasure::ostreamable instead, In Christ, Steven Watanabe