X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fprint.h;h=29da9f4b2eab9bf07a7fbeff8ffe4c4624838632;hp=65744cbf69368b6da18cc37cd82dec2231ecee4c;hb=817e584903996a041692640720a5a272d847a3c7;hpb=c7afef88380ebebc8c2b04e48664d73281ec8848 diff --git a/source/io/print.h b/source/io/print.h index 65744cb..29da9f4 100644 --- a/source/io/print.h +++ b/source/io/print.h @@ -1,7 +1,7 @@ #ifndef MSP_IO_PRINT_H_ #define MSP_IO_PRINT_H_ -#include +#include #include "base.h" #include "console.h" @@ -15,6 +15,12 @@ completeness with the other print functions. inline unsigned print(Base &o, const std::string &f) { return o.write(f); } +#if __cplusplus>=201103L +template +inline unsigned print(Base &o, const std::string &f, Args... args) +{ return print(o, format(f, args...)); } + +#else template inline unsigned print(Base &o, const std::string &f, A1 a1) { return print(o, format(f, a1)); } @@ -34,12 +40,19 @@ inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4) template inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { return print(o, format(f, a1, a2, a3, a4, a5)); } +#endif /* The following functions print to console */ inline unsigned print(const std::string &f) { return print(cout, f); } +#if __cplusplus>=201103L +template +inline unsigned print(const std::string &f, Args... args) +{ return print(cout, f, args...); } + +#else template inline unsigned print(const std::string &f, A1 a1) { return print(cout, f, a1); } @@ -59,6 +72,7 @@ inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4) template inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { return print(cout, f, a1, a2, a3, a4, a5); } +#endif } // namespace IO } // namespace Msp