1 #ifndef MSP_IO_PRINT_H_
2 #define MSP_IO_PRINT_H_
4 #include <msp/strings/format.h>
12 Writes a string to an I/O object. Same as o.write(f). Provided for
13 completeness with the other print functions.
15 inline unsigned print(Base &o, const std::string &f)
16 { return o.write(f); }
18 #if __cplusplus>=201103L
19 template<typename... Args>
20 inline unsigned print(Base &o, const std::string &f, Args... args)
21 { return print(o, format(f, args...)); }
25 inline unsigned print(Base &o, const std::string &f, A1 a1)
26 { return print(o, format(f, a1)); }
28 template<typename A1, typename A2>
29 inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2)
30 { return print(o, format(f, a1, a2)); }
32 template<typename A1, typename A2, typename A3>
33 inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3)
34 { return print(o, format(f, a1, a2, a3)); }
36 template<typename A1, typename A2, typename A3, typename A4>
37 inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4)
38 { return print(o, format(f, a1, a2, a3, a4)); }
40 template<typename A1, typename A2, typename A3, typename A4, typename A5>
41 inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
42 { return print(o, format(f, a1, a2, a3, a4, a5)); }
45 /* The following functions print to console */
47 inline unsigned print(const std::string &f)
48 { return print(cout, f); }
50 #if __cplusplus>=201103L
51 template<typename... Args>
52 inline unsigned print(const std::string &f, Args... args)
53 { return print(cout, f, args...); }
57 inline unsigned print(const std::string &f, A1 a1)
58 { return print(cout, f, a1); }
60 template<typename A1, typename A2>
61 inline unsigned print(const std::string &f, A1 a1, A2 a2)
62 { return print(cout, f, a1, a2); }
64 template<typename A1, typename A2, typename A3>
65 inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3)
66 { return print(cout, f, a1, a2, a3); }
68 template<typename A1, typename A2, typename A3, typename A4>
69 inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4)
70 { return print(cout, f, a1, a2, a3, a4); }
72 template<typename A1, typename A2, typename A3, typename A4, typename A5>
73 inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
74 { return print(cout, f, a1, a2, a3, a4, a5); }