• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_VOLATILE_HPP
10 #define BOOST_CLBL_TRTS_REMOVE_MEMBER_VOLATILE_HPP
11 
12 #include <boost/callable_traits/detail/core.hpp>
13 
14 namespace boost { namespace callable_traits {
15 
16 //[ remove_member_volatile_hpp
17 /*`
18 [section:ref_remove_member_volatile remove_member_volatile]
19 [heading Header]
20 ``#include <boost/callable_traits/remove_member_volatile.hpp>``
21 [heading Definition]
22 */
23 
24 template<typename T>
25 using remove_member_volatile_t = //see below
26 //<-
27     detail::try_but_fail_if_invalid<
28         typename detail::traits<T>::remove_member_volatile,
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_volatile_impl {};
35 
36     template<typename T>
37     struct remove_member_volatile_impl <T, typename std::is_same<
38         remove_member_volatile_t<T>, detail::dummy>::type>
39     {
40         using type = remove_member_volatile_t<T>;
41     };
42 }
43 
44 //->
45 
46 template<typename T>
47 struct remove_member_volatile : detail::remove_member_volatile_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 `volatile` qualifier from `T`, if present.
61 
62 [heading Input/Output Examples]
63 [table
64     [[`T`]                              [`remove_member_volatile_t<T>`]]
65     [[`int() volatile`]                 [`int()`]]
66     [[`int(foo::*)() volatile`]         [`int(foo::*)()`]]
67     [[`int(foo::*)() volatile &`]       [`int(foo::*)() &`]]
68     [[`int(foo::*)() volatile &&`]      [`int(foo::*)() &&`]]
69     [[`int(foo::*)() volatile`]         [`int(foo::*)()`]]
70     [[`int(foo::*)() const volatile`]   [`int(foo::*)() const`]]
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_volatile.cpp]
80 [remove_member_volatile]
81 [endsect]
82 */
83 //]
84 
85 #endif // #ifndef BOOST_CLBL_TRTS_REMOVE_MEMBER_VOLATILE_HPP
86