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_CONST_HPP 10 #define BOOST_CLBL_TRTS_REMOVE_MEMBER_CONST_HPP 11 12 #include <boost/callable_traits/detail/core.hpp> 13 14 namespace boost { namespace callable_traits { 15 16 //[ remove_member_const_hpp 17 /*` 18 [section:ref_remove_member_const remove_member_const] 19 [heading Header] 20 ``#include <boost/callable_traits/remove_member_const.hpp>`` 21 [heading Definition] 22 */ 23 24 template<typename T> 25 using remove_member_const_t = //see below 26 //<- 27 detail::try_but_fail_if_invalid< 28 typename detail::traits<T>::remove_member_const, 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_const_impl {}; 35 36 template<typename T> 37 struct remove_member_const_impl <T, typename std::is_same< 38 remove_member_const_t<T>, detail::dummy>::type> 39 { 40 using type = remove_member_const_t<T>; 41 }; 42 } 43 44 //-> 45 46 template<typename T> 47 struct remove_member_const : detail::remove_member_const_impl<T> {}; 48 49 //<- 50 }} // namespace boost::callable_traits 51 //-> 52 53 /*` 54 [heading Constraints] 55 * `T` must be a function type or a member function pointer type 56 * If `T` is a pointer, it may not be cv/ref qualified 57 58 [heading Behavior] 59 * A substitution failure occurs if the constraints are violated. 60 * Removes the member `const` qualifier from `T`, if present. 61 62 [heading Input/Output Examples] 63 [table 64 [[`T`] [`remove_member_const_t<T>`]] 65 [[`int() const`] [`int()`]] 66 [[`int(foo::*)() const`] [`int(foo::*)()`]] 67 [[`int(foo::*)() const &`] [`int(foo::*)() &`]] 68 [[`int(foo::*)() const &&`] [`int(foo::*)() &&`]] 69 [[`int(foo::*)() const`] [`int(foo::*)()`]] 70 [[`int(foo::*)() const volatile`] [`int(foo::*)() volatile`]] 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_const.cpp] 80 [remove_member_const] 81 [endsect] 82 */ 83 //] 84 85 #endif // #ifndef BOOST_CLBL_TRTS_REMOVE_MEMBER_CONST_HPP 86