vararg and type-generic octa::write(ln)

master
Daniel Kolesa 2015-06-30 22:41:01 +01:00
parent 656ddb76af
commit 5ace1c4777
1 changed files with 24 additions and 0 deletions

View File

@ -121,6 +121,17 @@ static inline void write(const octa::String &s) {
fwrite(s.data(), 1, s.size(), ::stdout);
}
template<typename T>
static inline void write(const T &v) {
octa::write(octa::to_string(v));
}
template<typename T, typename ...A>
static inline void write(const T &v, const A &...args) {
octa::write(v);
write(args...);
}
static inline void writeln(const char *s) {
octa::write(s);
putc('\n', ::stdout);
@ -131,6 +142,19 @@ static inline void writeln(const octa::String &s) {
putc('\n', ::stdout);
}
template<typename T>
static inline void writeln(const T &v) {
octa::write(v);
putc('\n', ::stdout);
}
template<typename T, typename ...A>
static inline void writeln(const T &v, const A &...args) {
octa::write(v);
write(args...);
putc('\n', ::stdout);
}
}
#endif