forked from hsutter/cppfront
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpure2-is-with-unnamed-predicates.cpp
More file actions
44 lines (29 loc) · 1.38 KB
/
pure2-is-with-unnamed-predicates.cpp
File metadata and controls
44 lines (29 loc) · 1.38 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
#define CPP2_INCLUDE_STD Yes
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
#line 1 "pure2-is-with-unnamed-predicates.cpp2"
//=== Cpp2 type definitions and function declarations ===========================
#line 1 "pure2-is-with-unnamed-predicates.cpp2"
auto fun(auto const& v) -> void;
#line 15 "pure2-is-with-unnamed-predicates.cpp2"
[[nodiscard]] auto main() -> int;
//=== Cpp2 function definitions =================================================
#line 1 "pure2-is-with-unnamed-predicates.cpp2"
auto fun(auto const& v) -> void{
#line 2 "pure2-is-with-unnamed-predicates.cpp2"
if (cpp2::impl::is(v, ([](cpp2::impl::in<int> x) -> decltype(auto) { return cpp2::impl::cmp_greater(x,3); }))) {
std::cout << "" + cpp2::to_string(v) + " is integer bigger than 3" << std::endl;
}
if (cpp2::impl::is(v, ([](cpp2::impl::in<double> x) -> decltype(auto) { return cpp2::impl::cmp_greater(x,3); }))) {
std::cout << "" + cpp2::to_string(v) + " is double bigger than 3" << std::endl;
}
if (cpp2::impl::is(v, ([](auto const& x) -> decltype(auto) { return cpp2::impl::cmp_greater(x,3); }))) {
std::cout << "" + cpp2::to_string(v) + " is bigger than 3" << std::endl;
}
}
#line 15 "pure2-is-with-unnamed-predicates.cpp2"
[[nodiscard]] auto main() -> int{
fun(3.14);
fun(42);
fun('a');
}