C++ Library Extensions 2022.12.09
To help learn modern C++ programming
type_output.cpp
Go to the documentation of this file.
1/*
2 Author: Thomas Kim
3 First Edit: Feb. 03, 2021
4
5 Requirements: C++ compilers that supports C++17 Standards
6
7 clang++ -std=c++17 filename.cpp -ltbb -o output.exe
8 g++ -std=c++17 filename.cpp -ltbb -o output.exe
9 cl /EHsc /std:c++17 filename.cpp /Fe: output.exe
10 dpcpp -Qstd=c++17 filename.cpp -o output.exe
11*/
12
14#include <tpf_output.hpp>
15
16namespace types = tpf::types;
17
19auto& endl = tpf::endl; // one carriage-return and flush out to console
20auto& endL = tpf::endL; // two carriage-returns and flush out to console
21
23{
24
25 stream <<L"한글 시험입니다."<< endL;
26
27 std::tuple a{ 1, 2.5, 3.4f};
28
29 stream <<"a's type is " << Tpf_GetTypeCategory(a) << endL;
30 stream << "element values: " << a << endl;
31 stream << "element types : " >> a << endL;
32
33 std::tuple b{ 1.5, 6.4f, 2};
34
35 stream <<"b's type is " << Tpf_GetTypeCategory(b) << endL;
36 stream << "element values: " << b << endl;
37 stream << "element types : " >> b << endL;
38
39 auto c = a + b;
40
41 stream << a >> a <<" + " << b >> b <<"\n\n\t= " << c >> c << endL;
42
43 std::tuple d{a, b, 3u};
44 std::tuple e{b, a, 4ll};
45
46 stream <<"d's type is " << Tpf_GetTypeCategory(d) << endL;
47 stream << "element values: " << d << endl;
48 stream << "element types : " >> d << endL;
49
50 stream <<"e's type is " << Tpf_GetTypeCategory(e) << endL;
51 stream << "element values: " << e << endl;
52 stream << "element types : " >> e << endL;
53
54 auto f = d + e;
55
56 stream <<"f:"<< f << " = d:" << d << " + e:" <<e << endL;
57
58 stream <<"f's type is " << Tpf_GetTypeCategory(f) << endL;
59 stream << "element values: " << f << endl;
60 stream << "element types : " >> f << endL;
61
62 stream <<"\t\t--- By Thomas Kim, Feb. 04, 2020. ---"<<endL;
63}
64
65int main()
66{
68
70}
void load_default_locale(bool ShowLocaleName=false)
Load system default locale for string conversion.
Type to string name conversions are defined.
Definition: 31-visit.cpp:7
constexpr auto endL
Definition: tpf_output.hpp:974
constexpr auto endl
Definition: tpf_output.hpp:973
Stream output operators << are implemented.
Type functions are implemented.
#define Tpf_GetTypeCategory(instance_arg)
A macro that returns instance_arg's type category string name.
Definition: tpf_types.hpp:1428
auto & endl
Definition: type_output.cpp:19
tpf::sstream stream
Definition: type_output.cpp:18
void test_type_output()
Definition: type_output.cpp:22
auto & endL
Definition: type_output.cpp:20
int main()
Definition: type_output.cpp:65