diff --git a/triqs/utility/tuple_tools.hpp b/triqs/utility/tuple_tools.hpp index 83c37a2d..538cbd07 100644 --- a/triqs/utility/tuple_tools.hpp +++ b/triqs/utility/tuple_tools.hpp @@ -183,6 +183,26 @@ namespace triqs { namespace tuple { template auto fold_on_zip (F && f,T1 const & t1, T2 const & t2, R && r) DECL_AND_RETURN( fold_on_zip_impl::value-1,T1,T2>()(std::forward(f),t1,t2,std::forward(r))); + /* + * print a tuple + */ + template struct __s {}; + template void print_tuple_impl (std::ostream& os, T const& t, std::integral_constant ) {} + template void print_tuple_impl (std::ostream& os, T const& t, std::integral_constant ) { + os << std::get(t); + if (rpos>0) os << ','; + print_tuple_impl(os, t, std::integral_constant()); + } }} + +namespace std { + template std::ostream & operator << (std::ostream & os, std::tuple const & t) { + os << "("; + constexpr int L = sizeof...(T); + triqs::tuple::print_tuple_impl(os,t,std::integral_constant()); + return os << ")"; + } +} + #endif