Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:45

0001 /*
0002 
0003 @Copyright Barrett Adair 2015-2017
0004 Distributed under the Boost Software License, Version 1.0.
0005 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0006 
0007 */
0008 
0009 #ifndef BOOST_CLBL_TRTS_ADD_MEMBER_CV_HPP
0010 #define BOOST_CLBL_TRTS_ADD_MEMBER_CV_HPP
0011 
0012 #include <boost/callable_traits/detail/core.hpp>
0013 
0014 namespace boost { namespace callable_traits {
0015 
0016 //[ add_member_cv_hpp
0017 /*`
0018 [section:ref_add_member_cv add_member_cv]
0019 [heading Header]
0020 ``#include <boost/callable_traits/add_member_cv.hpp>``
0021 [heading Definition]
0022 */
0023 
0024 template<typename T>
0025 using add_member_cv_t = //see below
0026 //<-
0027 #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
0028 
0029     detail::sfinae_try<
0030         typename detail::traits<T>::add_member_cv,
0031 
0032         detail::fail_when_same<typename detail::traits<T>::add_member_cv,
0033                 detail::abominable_functions_not_supported_on_this_compiler,
0034             this_compiler_doesnt_support_abominable_function_types>,
0035 
0036         detail::fail_if_invalid<typename detail::traits<T>::add_member_cv,
0037             member_qualifiers_are_illegal_for_this_type>>;
0038 #else
0039 
0040     detail::try_but_fail_if_invalid<
0041         typename detail::traits<T>::add_member_cv,
0042         member_qualifiers_are_illegal_for_this_type>;
0043 
0044 #endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
0045 
0046 namespace detail {
0047 
0048     template<typename T, typename = std::false_type>
0049     struct add_member_cv_impl {};
0050 
0051     template<typename T>
0052     struct add_member_cv_impl <T, typename std::is_same<
0053         add_member_cv_t<T>, detail::dummy>::type>
0054     {
0055         using type = add_member_cv_t<T>;
0056     };
0057 }
0058 
0059 //->
0060 
0061 template<typename T>
0062 struct add_member_cv : detail::add_member_cv_impl<T> {};
0063 
0064 //<-
0065 }} // namespace boost::callable_traits
0066 //->
0067 
0068 /*`
0069 [heading Constraints]
0070 * `T` must be a function type or a member function pointer type
0071 * If `T` is a pointer, it may not be cv/ref qualified
0072 
0073 [heading Behavior]
0074 * A substitution failure occurs if the constraints are violated.
0075 * Adds member `const` and `volatile` qualifiers to `T`, if not already present.
0076 
0077 [heading Input/Output Examples]
0078 [table
0079     [[`T`]                              [`add_member_cv_t<T>`]]
0080     [[`int()`]                          [`int() const volatile`]]
0081     [[`int(foo::*)()`]                  [`int(foo::*)() const volatile`]]
0082     [[`int(foo::*)() &`]                [`int(foo::*)() const volatile &`]]
0083     [[`int(foo::*)() &&`]               [`int(foo::*)() const volatile &&`]]
0084     [[`int(foo::*)() const`]            [`int(foo::*)() const volatile`]]
0085     [[`int(foo::*)() volatile`]         [`int(foo::*)() const volatile`]]
0086     [[`int(foo::*)() transaction_safe`] [`int(foo::*)() const volatile transaction_safe`]]
0087     [[`int`]                            [(substitution failure)]]
0088     [[`int (&)()`]                      [(substitution failure)]]
0089     [[`int (*)()`]                      [(substitution failure)]]
0090     [[`int foo::*`]                     [(substitution failure)]]
0091     [[`int (foo::* const)()`]           [(substitution failure)]]
0092 ]
0093 
0094 [heading Example Program]
0095 [import ../example/add_member_cv.cpp]
0096 [add_member_cv]
0097 [endsect]
0098 */
0099 //]
0100 
0101 #endif