C++ Library Extensions 2022.12.09
To help learn modern C++ programming
tuple_variant_operations.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 c.exe
8 g++ -std=c++17 binary_operations.cpp -ltbb -o g.exe
9 cl /EHsc /std:c++17 binary_operations.cpp /Fe: m.exe
10 dpcpp -Qstd=c++17 /EHsc binary_operations.cpp -o d.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 stream <<"--- Tuple-Variant Binary Operations ---" << endL;
25
26 std::tuple t{1, 2.5, 3.6f};
27
28 using variant_t = std::variant<int, double, float>;
29
30 variant_t v;
31
32 v = 4;
33 auto a = (t - v) - v; stream << "a = " << a << ", Type: " >> a << endl;
34
35 auto av = types::convert_to_container<std::vector>(a);
36
37 stream << av >> av << endl;
38
39 stream <<"\t\t--- By Thomas Kim, Feb. 05, 2020. ---" << endl;
40}
41
42int main()
43{
45
46}
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.
tpf::sstream stream
void test_tuple_variant_operations()