• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 @file remove_transaction_safe
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_REMOVE_TRANSACTION_SAFE_HPP
11 #define BOOST_CLBL_TRTS_REMOVE_TRANSACTION_SAFE_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(remove_transaction_safe)
18 BOOST_CLBL_TRTS_SFINAE_MSG(remove_transaction_safe, cannot_remove_transaction_safe_from_this_type)
19 
20 //[ remove_transaction_safe_hpp
21 /*`
22 [section:ref_remove_transaction_safe remove_transaction_safe]
23 [heading Header]
24 ``#include <boost/callable_traits/remove_transaction_safe.hpp>``
25 [heading Definition]
26 */
27 
28 template<typename T>
29 using remove_transaction_safe_t = //see below
30 //<-
31     detail::try_but_fail_if_invalid<
32         typename detail::traits<T>::remove_transaction_safe,
33         cannot_remove_transaction_safe_from_this_type>;
34 
35 namespace detail {
36 
37     template<typename T, typename = std::false_type>
38     struct remove_transaction_safe_impl {};
39 
40     template<typename T>
41     struct remove_transaction_safe_impl <T, typename std::is_same<
42         remove_transaction_safe_t<T>, detail::dummy>::type>
43     {
44         using type = remove_transaction_safe_t<T>;
45     };
46 }
47 
48 //->
49 
50 template<typename T>
51 struct remove_transaction_safe : detail::remove_transaction_safe_impl<T> {};
52 
53 //<-
54 }} // namespace boost::callable_traits
55 //->
56 
57 /*`
58 
59 [heading Constraints]
60 * `T` must be one of the following:
61   * function type
62   * function pointer type
63   * function reference type
64   * member function pointer type
65 * If `T` is a pointer, it may not be cv/ref qualified
66 
67 [heading Behavior]
68 * A substitution failure occurs if the constraints are violated.
69 * Removes the member `transaction_safe` specifier from `T`, if present.
70 
71 [heading Input/Output Examples]
72 [table
73     [[`T`]                              [`remove_transaction_safe_t<T>`]]
74     [[`int() const transaction_safe`]   [`int() const`]]
75     [[`int(*)() transaction_safe`]      [`int(*)()`]]
76     [[`int(&)() transaction_safe`]      [`int(&)()`]]
77     [[`int(foo::*)() transaction_safe`] [`int(foo::*)()`]]
78     [[`int() const`]                    [`int() const`]]
79     [[`int(*)()`]                       [`int(*)()`]]
80     [[`int(&)()`]                       [`int(&)()`]]
81     [[`int`]                            [(substitution failure)]]
82     [[`int foo::*`]                     [(substitution failure)]]
83     [[`int (foo::* const)()`]           [(substitution failure)]]
84 ]
85 
86 [heading Example Program]
87 [import ../example/remove_transaction_safe.cpp]
88 [remove_transaction_safe]
89 [endsect]
90 */
91 //]
92 
93 #endif // #ifndef BOOST_CLBL_TRTS_REMOVE_TRANSACTION_SAFE_HPP
94