Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002 @file is_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_IS_TRANSACTION_SAFE_HPP
0011 #define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE_HPP
0012 
0013 #include <boost/callable_traits/detail/core.hpp>
0014 
0015 namespace boost { namespace callable_traits {
0016 
0017 //[ is_transaction_safe_hpp
0018 /*`[section:ref_is_transaction_safe is_transaction_safe]
0019 [heading Header]
0020 ``#include <boost/callable_traits/is_transaction_safe.hpp>``
0021 [heading Definition]
0022 */
0023 
0024 
0025 // inherits from either std::true_type or std::false_type
0026 template<typename T>
0027 struct is_transaction_safe;
0028 
0029 //<-
0030 template<typename T>
0031 struct is_transaction_safe : detail::traits<
0032     detail::shallow_decay<T>>::is_transaction_safe {
0033 
0034     using type = typename detail::traits<
0035         detail::shallow_decay<T>>::is_transaction_safe;
0036 };
0037 
0038 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
0039 
0040 template<typename T>
0041 struct is_transaction_safe_v {
0042     static_assert(std::is_same<T, detail::dummy>::value,
0043         "Variable templates not supported on this compiler.");
0044 };
0045 
0046 #else
0047 //->
0048 // only available when variable templates are supported
0049 template<typename T>
0050 //<-
0051 BOOST_CLBL_TRAITS_INLINE_VAR
0052 //->
0053 constexpr bool is_transaction_safe_v = //see below
0054 //<-
0055     detail::traits<detail::shallow_decay<T>>::is_transaction_safe::value;
0056 
0057 #endif
0058 
0059 }} // namespace boost::callable_traits
0060 //->
0061 
0062 /*`
0063 [heading Constraints]
0064 * none
0065 *
0066 [heading Behavior]
0067 * `is_transaction_safe<T>::value` is `true` when either: 
0068   * `T` is a function type, function pointer type, function reference type, or member function pointer type where the function has a `transaction_safe` specifier
0069   * `T` is a function object with a non-overloaded `operator()`, where the `operator()` has a `transaction_safe` specifier
0070 * On compilers that support variable templates, `is_transaction_safe_v<T>` is equivalent to `is_transaction_safe<T>::value`.
0071 
0072 [heading Input/Output Examples]
0073 [table
0074     [[`T`]                              [`is_transaction_safe_v<T>`]]
0075     [[`int() const transaction_safe`]   [`true`]]
0076     [[`int(*)() transaction_safe`]      [`true`]]
0077     [[`int(&)() transaction_safe`]      [`true`]]
0078     [[`int(foo::* const)() transaction_safe`] [`true`]]
0079     [[`int() const`]                    [`false`]]
0080     [[`int() volatile`]                 [`false`]]
0081     [[`int(foo::*)() const`]            [`false`]]
0082     [[`int() const`]                    [`false`]]
0083     [[`int() volatile`]                 [`false`]]
0084     [[`int() &`]                        [`false`]]
0085     [[`int(*)()`]                       [`false`]]
0086     [[`int`]                            [`false`]]
0087     [[`int foo::*`]                     [`false`]]
0088     [[`const int foo::*`]               [`false`]]
0089 ]
0090 
0091 [heading Example Program]
0092 [import ../example/is_transaction_safe.cpp]
0093 [is_transaction_safe]
0094 [endsect]
0095 */
0096 //]
0097 
0098 #endif // #ifndef BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE_HPP