]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/callable_traits/add_noexcept.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / callable_traits / add_noexcept.hpp
1 /*
2 @file add_noexcept
3
4 @Copyright Barrett Adair 2015-2017
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
7
8 */
9
10 #ifndef BOOST_CLBL_TRTS_ADD_NOEXCEPT_HPP
11 #define BOOST_CLBL_TRTS_ADD_NOEXCEPT_HPP
12
13 #include <boost/callable_traits/detail/core.hpp>
14
15 namespace boost { namespace callable_traits {
16
17 BOOST_CLBL_TRTS_DEFINE_SFINAE_ERROR_ORIGIN(add_noexcept)
18 BOOST_CLBL_TRTS_SFINAE_MSG(add_noexcept, cannot_add_noexcept_to_this_type)
19
20 #ifndef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
21 template<typename T>
22 struct add_noexcept_t {
23 static_assert(std::is_same<T, detail::dummy>::value,
24 "noexcept types not supported by this configuration.");
25 };
26
27 template<typename T>
28 struct add_noexcept {
29 static_assert(std::is_same<T, detail::dummy>::value,
30 "noexcept types not supported by this configuration.");
31 };
32
33 #else
34
35 //[ add_noexcept_hpp
36 /*`
37 [section:ref_add_noexcept add_noexcept]
38 [heading Header]
39 ``#include <boost/callable_traits/add_noexcept.hpp>``
40 [heading Definition]
41 */
42
43 template<typename T>
44 using add_noexcept_t = //see below
45 //<-
46 detail::try_but_fail_if_invalid<
47 typename detail::traits<T>::add_noexcept,
48 cannot_add_noexcept_to_this_type>;
49
50 namespace detail {
51
52 template<typename T, typename = std::false_type>
53 struct add_noexcept_impl {};
54
55 template<typename T>
56 struct add_noexcept_impl <T, typename std::is_same<
57 add_noexcept_t<T>, detail::dummy>::type>
58 {
59 using type = add_noexcept_t<T>;
60 };
61 }
62 //->
63
64 template<typename T>
65 struct add_noexcept : detail::add_noexcept_impl<T> {};
66
67 //<-
68 #endif // #ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
69 }} // namespace boost::callable_traits
70 //->
71
72 /*`
73 [heading Constraints]
74 * `T` must be one of the following:
75 * function type
76 * function pointer type
77 * function reference type
78 * member function pointer type
79 * If `T` is a pointer, it may not be cv/ref qualified
80
81 [heading Behavior]
82 * A substitution failure occurs if the constraints are violated.
83 * Adds a `noexcept` specifier to `T`, if not already present.
84
85 [heading Input/Output Examples]
86 [table
87 [[`T`] [`add_noexcept_t<T>`]]
88 [[`int()`] [`int() noexcept`]]
89 [[`int (&)()`] [`int(&)() noexcept`]]
90 [[`int (*)()`] [`int(*)() noexcept`]]
91 [[`int(foo::*)()`] [`int(foo::*)() noexcept`]]
92 [[`int(foo::*)() &`] [`int(foo::*)() & noexcept`]]
93 [[`int(foo::*)() &&`] [`int(foo::*)() && noexcept`]]
94 [[`int(foo::*)() const transaction_safe`] [`int(foo::*)() const transaction_safe noexcept`]]
95 [[`int(foo::*)() noexcept`] [`int(foo::*)() noexcept`]]
96 [[`int`] [(substitution failure)]]
97 [[`int foo::*`] [(substitution failure)]]
98 [[`int (*&)()`] [(substitution failure)]]
99 ]
100
101 [heading Example Program]
102 [import ../example/add_noexcept.cpp]
103 [add_noexcept]
104 [endsect]
105 */
106 //]
107
108 #endif // #ifndef BOOST_CLBL_TRTS_ADD_NOEXCEPT_HPP