forked from hsutter/cppfront
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpure2-defaulted-comparisons-and-final-types.cpp
More file actions
62 lines (42 loc) · 1.89 KB
/
pure2-defaulted-comparisons-and-final-types.cpp
File metadata and controls
62 lines (42 loc) · 1.89 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
#define CPP2_INCLUDE_STD Yes
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
#line 1 "pure2-defaulted-comparisons-and-final-types.cpp2"
#line 2 "pure2-defaulted-comparisons-and-final-types.cpp2"
class widget;
//=== Cpp2 type definitions and function declarations ===========================
#line 1 "pure2-defaulted-comparisons-and-final-types.cpp2"
#line 2 "pure2-defaulted-comparisons-and-final-types.cpp2"
class widget final
{
private: int v;
public: widget(cpp2::impl::in<int> value);
#line 6 "pure2-defaulted-comparisons-and-final-types.cpp2"
public: auto operator=(cpp2::impl::in<int> value) -> widget& ;
public: [[nodiscard]] auto operator==(widget const& that) const& -> bool = default;
public: [[nodiscard]] auto operator<=>(widget const& that) const& -> std::strong_ordering = default;
public: widget(widget const&) = delete; /* No 'that' constructor, suppress copy */
public: auto operator=(widget const&) -> void = delete;
#line 11 "pure2-defaulted-comparisons-and-final-types.cpp2"
};
auto main() -> int;
//=== Cpp2 function definitions =================================================
#line 1 "pure2-defaulted-comparisons-and-final-types.cpp2"
#line 6 "pure2-defaulted-comparisons-and-final-types.cpp2"
widget::widget(cpp2::impl::in<int> value)
: v{ value }{}
#line 6 "pure2-defaulted-comparisons-and-final-types.cpp2"
auto widget::operator=(cpp2::impl::in<int> value) -> widget& {
v = value;
return *this; }
#line 13 "pure2-defaulted-comparisons-and-final-types.cpp2"
auto main() -> int{
widget a {1};
widget b {2};
if (cpp2::impl::cmp_less(cpp2::move(a),cpp2::move(b))) {
std::cout << "less";
}
else {
std::cout << "more";
}
}