Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:45

0001 /*
0002 @file add_transaction_safe
0003 
0004 @Copyright Barrett Adair 2015-2017
0005 Distributed under the Boost Software License, Version 1.0.
0006 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0007 
0008 */
0009 
0010 #ifndef BOOST_CLBL_TRTS_ADD_TRANSACTION_SAFE_HPP
0011 #define BOOST_CLBL_TRTS_ADD_TRANSACTION_SAFE_HPP
0012 
0013 #include <boost/callable_traits/detail/core.hpp>
0014 
0015 namespace boost { namespace callable_traits {
0016 
0017 BOOST_CLBL_TRTS_DEFINE_SFINAE_ERROR_ORIGIN(add_transaction_safe)
0018 BOOST_CLBL_TRTS_SFINAE_MSG(add_transaction_safe, cannot_add_transaction_safe_to_this_type)
0019 
0020 #ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
0021 template<typename T>
0022 struct add_transaction_safe_t {
0023     static_assert(std::is_same<T, detail::dummy>::value,
0024         "transaction_safe not supported by this configuration.");
0025 };
0026 
0027 template<typename T>
0028 struct add_transaction_safe {
0029     static_assert(std::is_same<T, detail::dummy>::value,
0030         "transaction_safe not supported by this configuration.");
0031 };
0032 
0033 #else
0034 
0035 //[ add_transaction_safe_hpp
0036 /*`
0037 [section:ref_add_transaction_safe add_transaction_safe]
0038 [heading Header]
0039 ``#include <boost/callable_traits/add_transaction_safe.hpp>``
0040 [heading Definition]
0041 */
0042 
0043 
0044 template<typename T>
0045 using add_transaction_safe_t = //see below
0046 //<-
0047     detail::try_but_fail_if_invalid<
0048         typename detail::traits<T>::add_transaction_safe,
0049         cannot_add_transaction_safe_to_this_type>;
0050 
0051 namespace detail {
0052 
0053     template<typename T, typename = std::false_type>
0054     struct add_transaction_safe_impl {};
0055 
0056     template<typename T>
0057     struct add_transaction_safe_impl <T, typename std::is_same<
0058         add_transaction_safe_t<T>, detail::dummy>::type>
0059     {
0060         using type = add_transaction_safe_t<T>;
0061     };
0062 }
0063 //->
0064 
0065 template<typename T>
0066 struct add_transaction_safe
0067   : detail::add_transaction_safe_impl<T> {};
0068 
0069 //<-
0070 #endif // #ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
0071 }} // namespace boost::callable_traits
0072 //->
0073 
0074 /*`
0075 [heading Constraints]
0076 * `T` must be one of the following:
0077   * function type
0078   * function pointer type
0079   * function reference type
0080   * member function pointer type
0081 * If `T` is a pointer, it may not be cv/ref qualified
0082 
0083 [heading Behavior]
0084 * A substitution failure occurs if the constraints are violated.
0085 * Adds the `transaction_safe` specifier to `T`, if not already present.
0086 
0087 [heading Input/Output Examples]
0088 [table
0089     [[`T`]                              [`add_transaction_safe_t<T>`]]
0090     [[`int()`]                          [`int() transaction_safe`]]
0091     [[`int (&)()`]                      [`int(&)() transaction_safe`]]
0092     [[`int (*)()`]                      [`int(*)() transaction_safe`]]
0093     [[`int(foo::*)()`]                  [`int(foo::*)() transaction_safe`]]
0094     [[`int(foo::*)() &`]                [`int(foo::*)() & transaction_safe`]]
0095     [[`int(foo::*)() &&`]               [`int(foo::*)() && transaction_safe`]]
0096     [[`int(foo::*)() const`]            [`int(foo::*)() const transaction_safe`]]
0097     [[`int(foo::*)() transaction_safe`] [`int(foo::*)() transaction_safe`]]
0098     [[`int`]                            [(substitution failure)]]
0099     [[`int foo::*`]                     [(substitution failure)]]
0100     [[`int (*&)()`]                     [(substitution failure)]]
0101 ]
0102 
0103 [heading Example Program]
0104 [import ../example/add_transaction_safe.cpp]
0105 [add_transaction_safe]
0106 [endsect]
0107 */
0108 //]
0109 
0110 #endif // #ifndef BOOST_CLBL_TRTS_ADD_TRANSACTION_SAFE_HPP