Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 36 lines (29 sloc) 1.184 kb
c30e9167 »
2007-08-30 Make delimited output more flexible, handle io manipulators better.
1 #ifndef DELIMITED_OSTREAM_HPP
2 #define DELIMITED_OSTREAM_HPP
3
4 #include <iostream>
5 #include <ios>
e81bbfd7 »
2014-03-31 Remove the never used del_ostream.
6 #include <type_traits>
c30e9167 »
2007-08-30 Make delimited output more flexible, handle io manipulators better.
7
8 namespace del_ostream_detail
9 {
e81bbfd7 »
2014-03-31 Remove the never used del_ostream.
10 template<typename T> struct take_by_value
11 { enum { value = std::is_integral<T>::value || std::is_enum<T>::value }; };
c30e9167 »
2007-08-30 Make delimited output more flexible, handle io manipulators better.
12 }
13
4c791a0e »
2007-09-01 delimited_ostream.hpp: Add lighter-weight operator,-based solution.
14 template <typename Ch, typename Tr, typename T>
e81bbfd7 »
2014-03-31 Remove the never used del_ostream.
15 inline typename std::enable_if<
16 !del_ostream_detail::take_by_value<T>::value,
17 std::basic_ostream<Ch, Tr> >::type &
45d6c371 » Johannes Schaub
2009-09-20 prelude/delimited_ostream: Take integrals/enums by value so that no s…
18 operator,(std::basic_ostream<Ch, Tr> & o, T const & t)
19 { return o << ", " << t; }
20
21 template <typename Ch, typename Tr, typename T>
e81bbfd7 »
2014-03-31 Remove the never used del_ostream.
22 inline typename std::enable_if<
23 del_ostream_detail::take_by_value<T>::value,
24 std::basic_ostream<Ch, Tr> >::type &
45d6c371 » Johannes Schaub
2009-09-20 prelude/delimited_ostream: Take integrals/enums by value so that no s…
25 operator,(std::basic_ostream<Ch, Tr> & o, T const t)
4c791a0e »
2007-09-01 delimited_ostream.hpp: Add lighter-weight operator,-based solution.
26 { return o << ", " << t; }
27
28 template <typename Ch, typename Tr>
29 std::basic_ostream<Ch, Tr> & operator, (std::basic_ostream<Ch, Tr> & o, std::ios_base & (* const f) (std::ios_base &))
30 { return o << f; }
31
32 template <typename Ch, typename Tr>
33 std::basic_ostream<Ch, Tr> & operator, (std::basic_ostream<Ch, Tr> & o, std::basic_ostream<Ch, Tr> & (* const f) (std::basic_ostream<Ch, Tr> &))
34 { return o << f; }
35
c30e9167 »
2007-08-30 Make delimited output more flexible, handle io manipulators better.
36 #endif // header guard
Something went wrong with that request. Please try again.