MCPcopy Create free account
hub / github.com/boostorg/leaf / val

Class val

test/result_state_test.cpp:22–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20static_assert(std::is_same<int const &, leaf::result<int const &>::value_type>::value, "Bad value_type");
21
22struct val
23{
24 static int id_count;
25 static int count;
26 int id;
27 float a = 0;
28 int b = 0;
29
30 val( float a, int b ) noexcept:
31 id(++id_count),
32 a(a),
33 b(b)
34 {
35 ++count;
36 }
37
38 val() noexcept:
39 id(++id_count)
40 {
41 ++count;
42 }
43
44 val( val const & x ) noexcept:
45 id(x.id)
46 {
47 ++count;
48 }
49
50 val( val && x ) noexcept:
51 id(x.id)
52 {
53 ++count;
54 }
55
56 ~val() noexcept
57 {
58 --count;
59 }
60
61 friend bool operator==( val const & a, val const & b ) noexcept
62 {
63 return a.id == b.id;
64 }
65
66 friend std::ostream & operator<<( std::ostream & os, val const & v ) noexcept
67 {
68 return os << v.id;
69 }
70};
71int val::count = 0;
72int val::id_count = 0;
73

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by 1

mainFunction · 0.56