-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathweek13-app1.cpp
54 lines (42 loc) · 1.05 KB
/
week13-app1.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
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <vector>
#include <range/v3/all.hpp>
using namespace ranges;
// to_string
// multiply_by
// vector<double>, vector<char>
// accumulate(view, init)
// action::sort
// action::unique
// [a, b] = views::cartesian_product
// inner_product, views::generate
template<typename LEFT, typename RIGHT>
auto operator |(const LEFT& left, const RIGHT& right)
{
return right(left);
}
//auto to_string()
//{
// return [](const auto& value) {
// return std::to_string(value);
// };
//}
auto to_string = [] { return [](const auto& value) { return std::to_string(value); }; };
//template<typename T>
//auto multiply_by(T what)
//{
// return [=](auto value) {
// return value * what;
// };
//}
auto multiply_by = [](auto what) { return [=](auto value) { return value * what; }; };
int main(int argc, char* argv[])
{
// auto s = to_string()(5.3);
auto s = 5.3 | to_string();
std::cout << s << std::endl;
auto m = multiply_by(100);
auto result = 2.5 | m;
std::cout << result << std::endl;
return 0;
}