-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSource.cpp
44 lines (30 loc) · 964 Bytes
/
Source.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <string>
#include <vector>
#include "inc/tuple.hpp"
int main()
{
int a = 5;
float b = 5.5f;
std::string c = "5.5f";
auto t = ctl::make_tuple(a, b, c);
std::cout << ctl::get<0>(t) << '\n';
std::cout << ctl::get<1>(t) << '\n';
std::cout << ctl::get<2>(t) << '\n';
int d = 5;
ctl::tuple<int&> ub(d);
get<0>(ub) = 6;
std::cout << d << '\n';
ctl::tuple<size_t, std::string> initializer(5, "Cristi");
std::vector<std::string> vec = ctl::make_from_tuple<std::vector<std::string>>(initializer);
for (const auto& word : vec)
{
std::cout << word << '\n';
}
ctl::tuple<std::string> str = "Cristi";
std::string temp = ctl::get<std::string>(std::move(str)) + " moved";
std::cout << ctl::get<std::string>(str) << '\n';
std::cout << temp << '\n';
using trivial_mixed_tuple = ctl::tuple<int, double&, const float, char&&, const void*&&>;
std::cout << typeid(ctl::tuple_element_t<0, trivial_mixed_tuple>).name();
}