Skip to content

Commit 697fb53

Browse files
committed
Prefer static constexpr bool over std::true_type or std::false_type
1 parent 2a56a3a commit 697fb53

19 files changed

+69
-74
lines changed

include/boost/callable_traits/detail/default_callable_traits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct default_callable_traits {
6767

6868
// std::true_type when the signature includes noexcept, when
6969
// the feature is available
70-
using is_noexcept = std::false_type;
70+
static constexpr bool is_noexcept = false;
7171

7272
// adds noexcept to a signature if the feature is available
7373
using add_noexcept = error_t;
@@ -77,7 +77,7 @@ struct default_callable_traits {
7777

7878
// std::true_type when the signature includes transaction_safe, when
7979
// the feature is available
80-
using is_transaction_safe = std::false_type;
80+
static constexpr bool is_transaction_safe = false;
8181

8282
// adds transaction_safe to a signature if the feature is available
8383
using add_transaction_safe = error_t;

include/boost/callable_traits/detail/function_object.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ struct function_object : Base {
3333
using invoke_type = error_t;
3434
using remove_varargs = error_t;
3535
using add_varargs = error_t;
36-
using is_noexcept = typename Base::is_noexcept;
36+
static constexpr bool is_noexcept = Base::is_noexcept;
3737
using add_noexcept = error_t;
3838
using remove_noexcept = error_t;
39-
using is_transaction_safe = typename Base::is_transaction_safe;
39+
static constexpr bool is_transaction_safe = Base::is_transaction_safe;
4040
using add_transaction_safe = error_t;
4141
using remove_transaction_safe = error_t;
4242
using clear_args = error_t;

include/boost/callable_traits/detail/unguarded/function.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ DO NOT INCLUDE THIS HEADER DIRECTLY
99
*/
1010

1111
#define BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
12-
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE std::false_type
12+
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE false
1313
#include <boost/callable_traits/detail/unguarded/function_2.hpp>
1414
#undef BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
1515
#undef BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE
1616

1717
#ifdef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
18-
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE std::true_type
18+
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE true
1919
#define BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE transaction_safe
2020
#include <boost/callable_traits/detail/unguarded/function_2.hpp>
2121
#undef BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
2222
#undef BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE
23-
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
23+
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE

include/boost/callable_traits/detail/unguarded/function_2.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ DO NOT INCLUDE THIS HEADER DIRECTLY
99
*/
1010

1111
#define BOOST_CLBL_TRTS_NOEXCEPT_SPEC
12-
#define BOOST_CLBL_TRTS_IS_NOEXCEPT std::false_type
12+
#define BOOST_CLBL_TRTS_IS_NOEXCEPT false
1313
#include <boost/callable_traits/detail/unguarded/function_3.hpp>
1414
#undef BOOST_CLBL_TRTS_NOEXCEPT_SPEC
1515
#undef BOOST_CLBL_TRTS_IS_NOEXCEPT
1616

1717
#ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
1818
#define BOOST_CLBL_TRTS_NOEXCEPT_SPEC noexcept
19-
#define BOOST_CLBL_TRTS_IS_NOEXCEPT std::true_type
19+
#define BOOST_CLBL_TRTS_IS_NOEXCEPT true
2020
#include <boost/callable_traits/detail/unguarded/function_3.hpp>
2121
#undef BOOST_CLBL_TRTS_NOEXCEPT_SPEC
2222
#undef BOOST_CLBL_TRTS_IS_NOEXCEPT
23-
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
23+
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES

include/boost/callable_traits/detail/unguarded/function_3.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS - the function-level qualifiers for the
1515
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE - the transaction_safe specifier for
1616
the current include (`transaction_safe` or nothing)
1717
18-
BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE - `std::true_type` or `std::false_type`,
18+
BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE - `true` or `false`,
1919
tied on whether BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE is `transaction_safe`
2020
2121
BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER - `transaction_safe` when
@@ -24,7 +24,7 @@ BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER - `transaction_safe` when
2424
BOOST_CLBL_TRTS_NOEXCEPT_SPEC - the noexcept specifier for
2525
the current include (`noexcept` or nothing)
2626
27-
BOOST_CLBL_TRTS_IS_NOEXCEPT - `std::true_type` or `std::false_type`,
27+
BOOST_CLBL_TRTS_IS_NOEXCEPT - `true` or `false`,
2828
tied on whether BOOST_CLBL_TRTS_NOEXCEPT_SPEC is `noexcept`
2929
3030
BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER - `noexcept` if
@@ -67,7 +67,7 @@ struct function<Return(Args...)
6767
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
6868
BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
6969

70-
using is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
70+
static constexpr bool is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
7171

7272
using remove_noexcept = Return(Args...)
7373
BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
@@ -78,7 +78,7 @@ struct function<Return(Args...)
7878
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
7979
BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER;
8080

81-
using is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
81+
static constexpr bool is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
8282

8383
using remove_transaction_safe = Return(Args...)
8484
BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
@@ -92,8 +92,8 @@ struct function<Return(Args...)
9292
using qualifiers = default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>;
9393

9494
template<qualifier_flags Flags>
95-
using set_qualifiers = set_function_qualifiers<Flags, is_transaction_safe::value,
96-
is_noexcept::value, Return, Args...>;
95+
using set_qualifiers = set_function_qualifiers<Flags, is_transaction_safe,
96+
is_noexcept, Return, Args...>;
9797

9898
#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
9999

@@ -178,7 +178,7 @@ struct function<Return (Args..., ...)
178178

179179
using add_varargs = type;
180180

181-
using is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
181+
static constexpr bool is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
182182

183183
using remove_noexcept = Return(Args..., ...)
184184
BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
@@ -189,7 +189,7 @@ struct function<Return (Args..., ...)
189189
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
190190
BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER;
191191

192-
using is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
192+
static constexpr bool is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
193193

194194
using remove_transaction_safe = Return(Args..., ...)
195195
BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
@@ -203,8 +203,8 @@ struct function<Return (Args..., ...)
203203
using qualifiers = default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>;
204204

205205
template<qualifier_flags Flags>
206-
using set_qualifiers = set_varargs_function_qualifiers<Flags, is_transaction_safe::value,
207-
is_noexcept::value, Return, Args...>;
206+
using set_qualifiers = set_varargs_function_qualifiers<Flags, is_transaction_safe,
207+
is_noexcept, Return, Args...>;
208208

209209
#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
210210

include/boost/callable_traits/detail/unguarded/function_ptr.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ DO NOT INCLUDE THIS HEADER DIRECTLY
99
*/
1010

1111
#define BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
12-
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE std::false_type
12+
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE false
1313
#include <boost/callable_traits/detail/unguarded/function_ptr_2.hpp>
1414

1515
#undef BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
1616
#undef BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE
1717

1818
#ifdef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
19-
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE std::true_type
19+
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE true
2020
#define BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE transaction_safe
2121
#include <boost/callable_traits/detail/unguarded/function_ptr_2.hpp>
2222
#endif

include/boost/callable_traits/detail/unguarded/function_ptr_2.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ DO NOT INCLUDE THIS HEADER DIRECTLY
99
*/
1010

1111
#define BOOST_CLBL_TRTS_NOEXCEPT_SPEC
12-
#define BOOST_CLBL_TRTS_IS_NOEXCEPT std::false_type
12+
#define BOOST_CLBL_TRTS_IS_NOEXCEPT false
1313
#include <boost/callable_traits/detail/unguarded/function_ptr_3.hpp>
1414
#undef BOOST_CLBL_TRTS_NOEXCEPT_SPEC
1515
#undef BOOST_CLBL_TRTS_IS_NOEXCEPT
1616

1717
#ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
1818
#define BOOST_CLBL_TRTS_NOEXCEPT_SPEC noexcept
19-
#define BOOST_CLBL_TRTS_IS_NOEXCEPT std::true_type
19+
#define BOOST_CLBL_TRTS_IS_NOEXCEPT true
2020
#include <boost/callable_traits/detail/unguarded/function_ptr_3.hpp>
2121
#undef BOOST_CLBL_TRTS_NOEXCEPT_SPEC
2222
#undef BOOST_CLBL_TRTS_IS_NOEXCEPT
23-
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
23+
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES

include/boost/callable_traits/detail/unguarded/function_ptr_3.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ macros used:
1212
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE - the transaction_safe specifier for
1313
the current include (`transaction_safe` or nothing)
1414
15-
BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE - `std::true_type` or `std::false_type`,
15+
BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE - `true` or `false`,
1616
tied on whether BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE is `transaction_safe`
1717
1818
BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER - `transaction_safe` when
@@ -21,7 +21,7 @@ BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER - `transaction_safe` when
2121
BOOST_CLBL_TRTS_NOEXCEPT_SPEC - the noexcept specifier for
2222
the current include (`noexcept` or nothing)
2323
24-
BOOST_CLBL_TRTS_IS_NOEXCEPT - `std::true_type` or `std::false_type`,
24+
BOOST_CLBL_TRTS_IS_NOEXCEPT - `true` or `false`,
2525
tied on whether BOOST_CLBL_TRTS_NOEXCEPT_SPEC is `noexcept`
2626
2727
BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER - `noexcept` if
@@ -56,7 +56,7 @@ struct function<
5656
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
5757
BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
5858

59-
using is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
59+
static constexpr bool is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
6060

6161
using remove_noexcept = Return(BOOST_CLBL_TRTS_CC *)(Args...)
6262
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE;
@@ -65,7 +65,7 @@ struct function<
6565
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
6666
BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER;
6767

68-
using is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
68+
static constexpr bool is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
6969

7070
using remove_transaction_safe = Return(BOOST_CLBL_TRTS_CC *)(Args...)
7171
BOOST_CLBL_TRTS_NOEXCEPT_SPEC;

include/boost/callable_traits/detail/unguarded/function_ptr_varargs.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ DO NOT INCLUDE THIS HEADER DIRECTLY
99
*/
1010

1111
#define BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
12-
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE std::false_type
12+
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE false
1313
#include <boost/callable_traits/detail/unguarded/function_ptr_varargs_2.hpp>
1414
#undef BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
1515
#undef BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE
1616

1717
#ifdef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
18-
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE std::true_type
18+
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE true
1919
#define BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE transaction_safe
2020
#include <boost/callable_traits/detail/unguarded/function_ptr_varargs_2.hpp>
2121
#undef BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
2222
#undef BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE
23-
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
23+
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE

include/boost/callable_traits/detail/unguarded/function_ptr_varargs_2.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ DO NOT INCLUDE THIS HEADER DIRECTLY
99
*/
1010

1111
#define BOOST_CLBL_TRTS_NOEXCEPT_SPEC
12-
#define BOOST_CLBL_TRTS_IS_NOEXCEPT std::false_type
12+
#define BOOST_CLBL_TRTS_IS_NOEXCEPT false
1313
#include <boost/callable_traits/detail/unguarded/function_ptr_varargs_3.hpp>
1414
#undef BOOST_CLBL_TRTS_NOEXCEPT_SPEC
1515
#undef BOOST_CLBL_TRTS_IS_NOEXCEPT
1616

1717
#ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
1818
#define BOOST_CLBL_TRTS_NOEXCEPT_SPEC noexcept
19-
#define BOOST_CLBL_TRTS_IS_NOEXCEPT std::true_type
19+
#define BOOST_CLBL_TRTS_IS_NOEXCEPT true
2020
#include <boost/callable_traits/detail/unguarded/function_ptr_varargs_3.hpp>
2121
#undef BOOST_CLBL_TRTS_NOEXCEPT_SPEC
2222
#undef BOOST_CLBL_TRTS_IS_NOEXCEPT
23-
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
23+
#endif // #ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES

0 commit comments

Comments
 (0)