Back to home page

EIC code displayed by LXR

 
 

    


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

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