]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | /* |
2 | ||
3 | @Copyright Barrett Adair 2015-2017 | |
4 | ||
5 | Distributed under the Boost Software License, Version 1.0. | |
6 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | */ | |
9 | ||
10 | #ifndef BOOST_CLBL_TRTS_REMOVE_MEMBER_CV_HPP | |
11 | #define BOOST_CLBL_TRTS_REMOVE_MEMBER_CV_HPP | |
12 | ||
13 | #include <boost/callable_traits/detail/core.hpp> | |
14 | ||
15 | namespace boost { namespace callable_traits { | |
16 | ||
17 | //[ remove_member_cv_hpp | |
18 | /*` | |
19 | [section:ref_remove_member_cv remove_member_cv] | |
20 | [heading Header] | |
21 | ``#include <boost/callable_traits/remove_member_cv.hpp>`` | |
22 | [heading Definition] | |
23 | */ | |
24 | ||
25 | template<typename T> | |
26 | using remove_member_cv_t = //see below | |
27 | //<- | |
28 | detail::try_but_fail_if_invalid< | |
29 | typename detail::traits<T>::remove_member_cv, | |
30 | member_qualifiers_are_illegal_for_this_type>; | |
31 | ||
32 | namespace detail { | |
33 | ||
34 | template<typename T, typename = std::false_type> | |
35 | struct remove_member_cv_impl {}; | |
36 | ||
37 | template<typename T> | |
38 | struct remove_member_cv_impl <T, typename std::is_same< | |
39 | remove_member_cv_t<T>, detail::dummy>::type> | |
40 | { | |
41 | using type = remove_member_cv_t<T>; | |
42 | }; | |
43 | } | |
44 | ||
45 | //-> | |
46 | ||
47 | template<typename T> | |
48 | struct remove_member_cv : detail::remove_member_cv_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 occurs if the constraints are violated. | |
61 | * Removes member `const` and/or `volatile` qualifiers from `T`, if present. | |
62 | ||
63 | [heading Input/Output Examples] | |
64 | [table | |
65 | [[`T`] [`remove_member_cv_t<T>`]] | |
66 | [[`int() const volatile`] [`int()`]] | |
67 | [[`int(foo::*)() const volatile`] [`int(foo::*)()`]] | |
68 | [[`int(foo::*)() volatile`] [`int(foo::*)()`]] | |
69 | [[`int(foo::*)() const`] [`int(foo::*)()`]] | |
70 | [[`int(foo::*)() const &`] [`int(foo::*)() &`]] | |
71 | [[`int(foo::*)() const &&`] [`int(foo::*)() &&`]] | |
72 | [[`int(foo::*)() const`] [`int(foo::*)()`]] | |
73 | [[`int`] [(substitution failure)]] | |
74 | [[`int (&)()`] [(substitution failure)]] | |
75 | [[`int (*)()`] [(substitution failure)]] | |
76 | [[`int foo::*`] [(substitution failure)]] | |
77 | [[`int (foo::* const)()`] [(substitution failure)]] | |
78 | ] | |
79 | ||
80 | [heading Example Program] | |
81 | [import ../example/remove_member_cv.cpp] | |
82 | [remove_member_cv] | |
83 | [endsect] | |
84 | */ | |
85 | //] | |
86 | ||
87 | #endif // #ifndef BOOST_CLBL_TRTS_REMOVE_MEMBER_CV_HPP |