forked from hsutter/cppfront
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmixed-parameter-passing-with-forward.cpp
More file actions
82 lines (59 loc) · 2.24 KB
/
mixed-parameter-passing-with-forward.cpp
File metadata and controls
82 lines (59 loc) · 2.24 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#line 2 "mixed-parameter-passing-with-forward.cpp2"
#include <string>
#include <cstdlib>
#include <ctime>
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
#line 1 "mixed-parameter-passing-with-forward.cpp2"
//=== Cpp2 type definitions and function declarations ===========================
#line 1 "mixed-parameter-passing-with-forward.cpp2"
#line 6 "mixed-parameter-passing-with-forward.cpp2"
auto copy_from([[maybe_unused]] auto unnamed_param_1) -> void;
auto parameter_styles(
[[maybe_unused]] cpp2::impl::in<std::string> unnamed_param_1, // "in" is default
std::string b,
[[maybe_unused]] std::string& unnamed_param_3,
std::string&& d,
auto&& e
) -> void
CPP2_REQUIRES (std::is_convertible_v<CPP2_TYPEOF(e), std::add_const_t<std::string>&>)
#line 8 "mixed-parameter-passing-with-forward.cpp2"
;
#line 42 "mixed-parameter-passing-with-forward.cpp2"
[[nodiscard]] auto main() -> int;
//=== Cpp2 function definitions =================================================
#line 1 "mixed-parameter-passing-with-forward.cpp2"
#line 6 "mixed-parameter-passing-with-forward.cpp2"
auto copy_from([[maybe_unused]] auto unnamed_param_1) -> void{}
#line 8 "mixed-parameter-passing-with-forward.cpp2"
auto parameter_styles(
[[maybe_unused]] cpp2::impl::in<std::string> unnamed_param_1,
std::string b,
[[maybe_unused]] std::string& unnamed_param_3,
std::string&& d,
auto&& e
) -> void
requires (std::is_convertible_v<CPP2_TYPEOF(e), std::add_const_t<std::string>&>)
#line 15 "mixed-parameter-passing-with-forward.cpp2"
{
int z {12};
++z;
b += "plugh";
if (std::rand() % CPP2_ASSERT_NOT_ZERO_LITERAL(CPP2_TYPEOF(std::rand()),2)) {
++z;
copy_from(cpp2::move(b));// definite last use
}
else {
copy_from(&b); // NB: better not move from this (why not?)
copy_from(cpp2::move(d));
copy_from(++z);
copy_from(CPP2_FORWARD(e));
}
// std::move(z);
copy_from(z);
if (std::time(nullptr) % CPP2_ASSERT_NOT_ZERO_LITERAL(CPP2_TYPEOF(std::time(nullptr)),2) == 0) {
copy_from(cpp2::move(z));
}
}
#line 42 "mixed-parameter-passing-with-forward.cpp2"
[[nodiscard]] auto main() -> int{}