]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/util/testsuite_counter_type.h
3 // Copyright (C) 2012-2018 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 #ifndef _TESTSUITE_COUNTER_TYPE_H
22 #define _TESTSUITE_COUNTER_TYPE_H 1
26 // Type counting how many constructors or assign operators are invoked.
29 // Constructor counters:
30 static int default_count
;
31 static int specialize_count
;
32 static int copy_count
;
33 static int copy_assign_count
;
34 static int less_compare_count
;
35 #if __cplusplus >= 201103L
36 static int move_count
;
37 static int move_assign_count
;
39 static int destructor_count
;
43 counter_type() : val(0)
46 counter_type(int inval
) : val(inval
)
47 { ++specialize_count
; }
49 counter_type(const counter_type
& in
) : val(in
.val
)
53 { ++destructor_count
; }
56 operator=(const counter_type
& in
)
63 #if __cplusplus >= 201103L
64 counter_type(counter_type
&& in
) noexcept
71 operator=(counter_type
&& rhs
) noexcept
85 copy_assign_count
= 0;
86 less_compare_count
= 0;
87 #if __cplusplus >= 201103L
89 move_assign_count
= 0;
94 bool operator==(const counter_type
& rhs
) const
95 { return val
== rhs
.val
; }
97 bool operator<(const counter_type
& rhs
) const
100 return val
< rhs
.val
;
104 int counter_type::default_count
= 0;
105 int counter_type::specialize_count
= 0;
106 int counter_type::copy_count
= 0;
107 int counter_type::copy_assign_count
= 0;
108 int counter_type::less_compare_count
= 0;
110 #if __cplusplus >= 201103L
111 int counter_type::move_count
= 0;
112 int counter_type::move_assign_count
= 0;
114 int counter_type::destructor_count
= 0;
116 struct counter_type_hasher
118 std::size_t operator()(const counter_type
& c
) const
124 } // namespace __gnu_test