add print_no_space function for use in first round

This commit is contained in:
Johannes Kapfhammer 2022-03-31 21:46:22 +02:00
parent 33bcd2f073
commit 19ddcef24e
Signed by: johannesk
GPG Key ID: 565B82ED229ACA80
2 changed files with 11 additions and 0 deletions

View File

@ -72,6 +72,11 @@ signed main() {
print(tuple{unordered_map<int, string>{{3,"three"},{1,"one"}}}); print(tuple{unordered_map<int, string>{{3,"three"},{1,"one"}}});
print(unordered_set<int>{3,1,4}); print(unordered_set<int>{3,1,4});
print_no_space("Case #", 0, ": ");
print_no_space(42);
print_no_space();
print();
redirect_input("example.in"); redirect_input("example.in");
print("reading from example.in:", read_string()); print("reading from example.in:", read_string());
redirect_input("example.in"); redirect_input("example.in");

View File

@ -97,4 +97,10 @@ void print() {
std::cout << '\n'; std::cout << '\n';
} }
template <typename... Args>
void print_no_space(Args&&... args) {
using expander = bool[];
(void)expander{0, (soi::io::print(std::cout, std::forward<Args>(args)), false)...};
}
#endif // SOI_HEADER_IO #endif // SOI_HEADER_IO