C++ Library Extensions 2022.12.09
To help learn modern C++ programming
056-make_vector.cpp
Go to the documentation of this file.
1#include <tpf_output.hpp>
2
5auto nl = tpf::nl;
6
8{
9 int a = 5;
10 const int c = 6;
11 int& lref = a;
12 int&& rref = 7;
13
14 auto v1 = tpf::make_vector(1, a, c, lref, rref);
15
16 stream << "Type of v1: " << Tpf_GetTypeCategory(v1) << nl
17 << "V1 = " << v1 << endl;
18
19 double d = 5;
20 const double e = 6.0;
21 double& f = d;
22 double&& g = 7.0;
23
24 auto v2 = tpf::make_vector(a, c, lref, rref, d, e, f, g);
25
26 stream << "Type of v2: " << Tpf_GetTypeCategory(v2) << nl
27 << "V2 = " << v2 << endl;
28
29 auto v3 = tpf::make_vector("James Dean", "Sophie Turner", "Members");
30
31 stream << "Type of v3: " << Tpf_GetTypeCategory(v3) << nl
32 << "V3 = " << v3 << endl;
33
34 int array1[]{1, 2, 3};
35 int array2[]{4, 5, 6};
36 int array3[]{7, 8, 9, 10};
37
38 auto v4 = tpf::make_vector(array1, array2, array3);
39
40 stream << "Type of v4: " << Tpf_GetTypeCategory(v4) << nl
41 << "V4 = " << v4 << endl;
42
43 std::pair<int, double> p;
44
45}
46
47int main()
48{
50}
void test_make_vector()
tpf::sstream stream
auto endl
auto nl
int main()
decltype(auto) make_vector(Type &&arg, Types &&... args)
Definition: tpf_types.hpp:7911
constexpr auto endl
Definition: tpf_output.hpp:973
constexpr auto nl
Definition: tpf_output.hpp:971
Stream output operators << are implemented.
#define Tpf_GetTypeCategory(instance_arg)
A macro that returns instance_arg's type category string name.
Definition: tpf_types.hpp:1428