add_member_rvalue_reference.hpp
Go to the documentation of this file.
1 /*
2 
3 @Copyright Barrett Adair 2015-2018
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6 
7 */
8 
9 #ifndef BOOST_CLBL_TRTS_ADD_MEMBER_RVALUE_REFERENCE_HPP
10 #define BOOST_CLBL_TRTS_ADD_MEMBER_RVALUE_REFERENCE_HPP
11 
13 
14 namespace boost { namespace callable_traits {
15 
16 //[ add_member_rvalue_reference_hpp
17 /*`
18 [section:ref_add_member_rvalue_reference add_member_rvalue_reference]
19 [heading Header]
20 ``#include <boost/callable_traits/add_member_rvalue_reference.hpp>``
21 [heading Definition]
22 */
23 //<-
24 #ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
25 
26 template<typename T>
28  static_assert(std::is_same<T, detail::dummy>::value,
29  "Reference member qualifiers are not supported by this configuration.");
30 };
31 
32 #else
33 //->
34 template<typename T>
35 using add_member_rvalue_reference_t = //see below
36 //<-
37 #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
38 
41 
43  detail::abominable_functions_not_supported_on_this_compiler,
44  this_compiler_doesnt_support_abominable_function_types>,
45 
47  member_qualifiers_are_illegal_for_this_type>>;
48 #else
49 
52  member_qualifiers_are_illegal_for_this_type>;
53 
54 #endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
55 #endif // #ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
56 
57 namespace detail {
58 
59  template<typename T, typename = std::false_type>
61 
62  template<typename T>
63  struct add_member_rvalue_reference_impl <T, typename std::is_same<
64  add_member_rvalue_reference_t<T>, detail::dummy>::type>
65  {
67  };
68 }
69 //->
70 
71 
72 template<typename T>
75 
76 //<-
77 }} // namespace boost::callable_traits
78 //->
79 
80 /*`
81 [heading Constraints]
82 * `T` must be a function type or a member function pointer type
83 * If `T` is a pointer, it may not be cv/ref qualified
84 
85 [heading Behavior]
86 * A substitution failure occurs if the constraints are violated.
87 * Adds a member rvalue reference qualifier (`&&`) to `T`, if not already present.
88 * If an lvalue reference qualifier is present, the lvalue reference qualifier remains (in accordance with reference collapsing rules).
89 
90 [heading Input/Output Examples]
91 [table
92  [[`T`] [`add_member_rvalue_reference_t<T>`]]
93  [[`int()`] [`int() &&`]]
94  [[`int(foo::*)()`] [`int(foo::*)() &&`]]
95  [[`int(foo::*)() &`] [`int(foo::*)() &`]]
96  [[`int(foo::*)() &&`] [`int(foo::*)() &&`]]
97  [[`int(foo::*)() const`] [`int(foo::*)() const &&`]]
98  [[`int(foo::*)() transaction_safe`] [`int(foo::*)() && transaction_safe`]]
99  [[`int`] [(substitution failure)]]
100  [[`int (&)()`] [(substitution failure)]]
101  [[`int (*)()`] [(substitution failure)]]
102  [[`int foo::*`] [(substitution failure)]]
103  [[`int (foo::* const)()`] [(substitution failure)]]
104 ]
105 
106 [heading Example Program]
107 [import ../example/add_member_rvalue_reference.cpp]
108 [add_member_rvalue_reference]
109 [endsect][/section:ref_add_member_rvalue_reference]
110 */
111 //]
112 
113 #endif
sfinae_try< T, fail_when_same< U, invalid_type, ErrorType >, fail_when_same< U, reference_error, reference_type_not_supported_by_this_metafunction > > try_but_fail_if_invalid
Definition: utility.hpp:58
typename BOOST_CLBL_TRTS_DISJUNCTION(function_object< unwrap_reference< T > >, function< T >, pmf< T >, pmd< T >, default_callable_traits< T >)::traits traits
Definition: traits.hpp:25
typename BOOST_CLBL_TRTS_DISJUNCTION(FailIfs..., success< T >)::_::type sfinae_try
detail::try_but_fail_if_invalid< typename detail::traits< T >::add_member_rvalue_reference, member_qualifiers_are_illegal_for_this_type > add_member_rvalue_reference_t