1 /* 2 3 @Copyright Barrett Adair 2015-2017 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_REMOVE_MEMBER_REFERENCE_HPP 10 #define BOOST_CLBL_TRTS_REMOVE_MEMBER_REFERENCE_HPP 11 12 #include <boost/callable_traits/detail/core.hpp> 13 14 namespace boost { namespace callable_traits { 15 16 //[ remove_member_reference_hpp 17 /*` 18 [section:ref_remove_member_reference remove_member_reference] 19 [heading Header] 20 ``#include <boost/callable_traits/remove_member_reference.hpp>`` 21 [heading Definition] 22 */ 23 24 template<typename T> 25 using remove_member_reference_t = //see below 26 //<- 27 detail::try_but_fail_if_invalid< 28 typename detail::traits<T>::remove_member_reference, 29 member_qualifiers_are_illegal_for_this_type>; 30 31 namespace detail { 32 33 template<typename T, typename = std::false_type> 34 struct remove_member_reference_impl {}; 35 36 template<typename T> 37 struct remove_member_reference_impl <T, typename std::is_same< 38 remove_member_reference_t<T>, detail::dummy>::type> 39 { 40 using type = remove_member_reference_t<T>; 41 }; 42 } 43 44 //-> 45 46 template<typename T> 47 struct remove_member_reference 48 : detail::remove_member_reference_impl<T> {}; 49 50 //<- 51 }} // namespace boost::callable_traits 52 //-> 53 54 /*` 55 [heading Constraints] 56 * `T` must be a function type or a member function pointer type 57 * If `T` is a pointer, it may not be cv/ref qualified 58 59 [heading Behavior] 60 * A substitution failure occuers if the constraints are violated. 61 * Removes member `&` or `&&` qualifiers from `T`, if present. 62 63 [heading Input/Output Examples] 64 [table 65 [[`T`] [`remove_member_const_t<T>`]] 66 [[`int() &`] [`int()`]] 67 [[`int(foo::*)() &`] [`int(foo::*)()`]] 68 [[`int(foo::*)() const &`] [`int(foo::*)() const`]] 69 [[`int(foo::*)() const &&`] [`int(foo::*)() const`]] 70 [[`int(foo::*)()`] [`int(foo::*)()`]] 71 [[`int`] [(substitution failure)]] 72 [[`int (&)()`] [(substitution failure)]] 73 [[`int (*)()`] [(substitution failure)]] 74 [[`int foo::*`] [(substitution failure)]] 75 [[`int (foo::* const)()`] [(substitution failure)]] 76 ] 77 78 [heading Example Program] 79 [import ../example/remove_member_reference.cpp] 80 [remove_member_reference] 81 [endsect] 82 */ 83 //] 84 85 #endif // #ifndef BOOST_CLBL_TRTS_REMOVE_MEMBER_REFERENCE_HPP 86