Theoretica
Mathematical Library
Loading...
Searching...
No Matches
io.h
Go to the documentation of this file.
1
5
6#ifndef THEORETICA_IO_H
7#define THEORETICA_IO_H
8
9#include <iostream>
10#include <string>
11
12
13namespace theoretica {
14
16 namespace io {
17
19 template<typename Type>
20 inline void print(const Type& curr) {
21 std::cout << curr;
22 }
23
26 template<typename Type, typename ...Args>
27 inline void print(const Type& curr, Args... args) {
28 std::cout << curr << " ";
29 print(args...);
30 }
31
32
34 inline void println() {
35 std::cout << "\n";
36 }
37
40 template<typename Type>
41 inline void println(const Type& curr) {
42 std::cout << curr << "\n";
43 }
44
47 template<typename Type, typename ...Args>
48 inline void println(const Type& curr, Args... args) {
49 std::cout << curr << " ";
50 println(args...);
51 }
52
53
57 inline std::string readln() {
58
59 std::string str;
60 std::getline(std::cin, str);
61
62 return str;
63 }
64
65
68 template<typename Type>
69 inline void readln(Type& last) {
70 std::cin >> last;
71 }
72
78 template<typename Type, typename ...Args>
79 inline void readln(Type& curr, Args&... args) {
80 std::cin >> curr;
81 readln(args...);
82 }
83
84 }
85}
86
87
88#endif
void print(const Type &curr)
Print the given argument to standard output.
Definition io.h:20
void println()
Print a newline to standard output.
Definition io.h:34
std::string readln()
Read a line from standard input, up to a line return.
Definition io.h:57
Main namespace of the library which contains all functions and objects.
Definition algebra.h:27
TH_CONSTEXPR Type make_error()
Create a number representing an error state, constructed from a NaN value.
Definition real_analysis.h:1322