diff options
Diffstat (limited to 'dev/lib/io')
| -rw-r--r-- | dev/lib/io/print.hpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/dev/lib/io/print.hpp b/dev/lib/io/print.hpp index e326845..36192c4 100644 --- a/dev/lib/io/print.hpp +++ b/dev/lib/io/print.hpp @@ -8,20 +8,34 @@ #ifndef _SNU_PRINT_HPP #define _SNU_PRINT_HPP +#include <initializer_list> #include <iostream> +#include <ostream> namespace snu::io -{ +{ + template <typename T> + inline void printv(T fmt) noexcept + { + std::cout << fmt; + } + + template <typename T> + inline void printv(std::initializer_list<T> fmt) noexcept + { + std::cout << fmt; + } + template <typename... T> - inline void print(T... fmt) + inline void print(T... fmt) noexcept { - std::cout << std::move(fmt...); + (printv(fmt), ...); } template <typename... T> - inline void println(T... fmt) + inline void println(T... fmt) noexcept { - std::cout << std::move(fmt...); + print(static_cast<T>(fmt)...); std::cout << std::endl; } } // namespace snu::io |
