Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef WS_IO_HPP_
- #define WS_IO_HPP_
- #include <iostream>
- #include "base.hpp"
- #include "ws/exception.hpp"
- namespace ws {
- namespace io {
- inline void write(){}
- template<typename T, typename... Args>
- inline void write(const T& o, Args... args){
- std::cout << o;
- write(args...);
- }
- template<typename T, typename... Args>
- inline void write(string s, T value, Args... args) {
- if(s.find('%') < s.size()){
- long i = s.find('%');
- write(s.substr(0, i));
- write(value);
- write(s.substr(i+1, s.size()-i-1), args...);
- } else {
- write(s);
- write(value, args...);
- }
- }
- template<typename... Args>
- inline void write(const char c[], Args... args){
- write(string(c), args...);
- }
- template<typename... Args>
- inline void writeln(Args... args){
- write(args...);
- std::cout << std::endl;
- }
- template<typename T>
- inline void getln(T& t){
- std::getline(std::cin, t);
- }
- inline string getln(){
- string line;
- std::getline(std::cin, line);
- return line;
- }
- }
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement