Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002 Copyright Barrett Adair 2016-2017
0003 
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_DETAIL_DEFAULT_BOOST_CLBL_TRTS_HPP
0010 #define BOOST_CLBL_TRTS_DETAIL_DEFAULT_BOOST_CLBL_TRTS_HPP
0011 
0012 namespace boost { namespace callable_traits { namespace detail {
0013           
0014 template<typename T = void>
0015 struct default_callable_traits {
0016 
0017     // value is used by all traits classes to participate 
0018     // in the <callable_traits/detail/traits.hpp> disjunction.
0019     static constexpr bool value = false;
0020     
0021     // used facilitate the disjunction in
0022     // <callable_traits/detail/traits.hpp>
0023     using traits = default_callable_traits;
0024     
0025     using error_t = error_type<T>;
0026 
0027     // represents the type under consideration
0028     using type = error_t;
0029     
0030     // std::true_type for callables with C-style variadics
0031     using has_varargs = std::false_type;
0032     
0033     using return_type = error_t;
0034     
0035     // arg_types is a std::tuple of argument types for
0036     // callables that are not overloaded/templated function objects.
0037     // arg_types IS defined in terms of INVOKE, which means
0038     // a PMF's arg_types tuple will use a reference to its
0039     // parent class as the first argument, with qualifiers added to
0040     // match the PMF's own qualifiers.
0041     using arg_types = error_t;
0042     
0043     // arg_types without the decltype(*this) parameter for member functions
0044     using non_invoke_arg_types = error_t;
0045 
0046     // An "approximation" of a callable type, in the form
0047     // of a plain function type. Defined in terms of INVOKE.
0048     // An identity alias for qualified/unqualified plain function
0049     // types.
0050     using function_type = error_t;
0051     
0052     // Used to smoothen the edges between PMFs and function objects
0053     using function_object_signature = error_t;
0054 
0055     // An identity alias for qualified/unqualified plain function
0056     // types. Equivalent to remove_member_pointer for PMFs. Same
0057     // as function_type for other callable types.
0058     using qualified_function_type = error_t;
0059     
0060     // Removes C-style variadics from a signature, if present.
0061     // Aliases error_t for function objects and PMDs.
0062     using remove_varargs = error_t;
0063     
0064     // Adds C-style variadics to a signature. Aliases
0065     // error_t for function objects and PMDs.
0066     using add_varargs = error_t;
0067     
0068     // std::true_type when the signature includes noexcept, when
0069     // the feature is available
0070     using is_noexcept = std::false_type;
0071 
0072     // adds noexcept to a signature if the feature is available
0073     using add_noexcept = error_t;
0074 
0075     // removes noexcept from a signature if present
0076     using remove_noexcept = error_t;
0077 
0078     // std::true_type when the signature includes transaction_safe, when
0079     // the feature is available
0080     using is_transaction_safe = std::false_type;
0081 
0082     // adds transaction_safe to a signature if the feature is available
0083     using add_transaction_safe = error_t;
0084 
0085     // removes transaction_safe from a signature if present
0086     using remove_transaction_safe = error_t;
0087 
0088     // The class of a PMD or PMF. error_t for other types
0089     using class_type = error_t;
0090     
0091     // The qualified reference type of class_type. error_t
0092     // for non-member-pointers.
0093     using invoke_type = error_t;
0094     
0095     // Removes reference qualifiers from a signature.
0096     using remove_reference = error_t;
0097     
0098     // Adds an lvalue qualifier to a signature, in arbitrary
0099     // accordance with C++11 reference collapsing rules.
0100     using add_member_lvalue_reference = error_t;
0101     
0102     // Adds an rvalue qualifier to a signature, in arbitrary
0103     // accordance with C++11 reference collapsing rules.
0104     using add_member_rvalue_reference = error_t;
0105     
0106     // Adds a const qualifier to a signature.
0107     using add_member_const = error_t;
0108     
0109     // Adds a volatile qualifier to a signature.
0110     using add_member_volatile = error_t;
0111     
0112     // Adds both const and volatile qualifiers to a signature.
0113     using add_member_cv = error_t;
0114     
0115     // Removes a const qualifier from a signature, if present.
0116     using remove_member_const = error_t;
0117     
0118     // Removes a volatile qualifier from a signature, if present.
0119     using remove_member_volatile = error_t;
0120     
0121     // Removes both const and volatile qualifiers from a
0122     // signature, if any.
0123     using remove_member_cv = error_t;
0124     
0125     // Removes the member pointer from PMDs and PMFs. An identity
0126     // alias for other callable types.
0127     using remove_member_pointer = error_t;
0128     
0129     // Changes the parent class type for PMDs and PMFs. Turns
0130     // function pointers, function references, and
0131     // qualified/unqualified function types into PMFs. Turns
0132     // everything else into member data pointers.
0133     template<typename C,
0134         typename U = T,
0135         typename K = typename std::remove_reference<U>::type,
0136         typename L = typename std::conditional<
0137             std::is_same<void, K>::value, error_t, K>::type,
0138         typename Class = typename std::conditional<
0139             std::is_class<C>::value, C, error_t>::type>
0140     using apply_member_pointer = typename std::conditional<
0141         std::is_same<L, error_t>::value || std::is_same<Class, error_t>::value,
0142         error_t, L Class::*>::type;
0143     
0144     // Changes the return type of PMFs, function pointers, function
0145     // references, and qualified/unqualified function types. Changes
0146     // the data type of PMDs. error_t for function objects.
0147     template<typename>
0148     using apply_return = error_t;
0149 
0150     // Expands the argument types into a template
0151     template<template<class...> class Container>
0152     using expand_args = error_t;
0153 
0154     template<template<class...> class Container, typename... RightArgs>
0155     using expand_args_left = error_t;
0156 
0157     template<template<class...> class Container, typename... LeftArgs>
0158     using expand_args_right = error_t;
0159 
0160     using clear_args = error_t;
0161     
0162     template<typename... NewArgs>
0163     using push_front = error_t;
0164 
0165     template<typename... NewArgs>
0166     using push_back = error_t;
0167     
0168     template<std::size_t ElementCount>
0169     using pop_front = error_t;
0170 
0171     template<std::size_t ElementCount>
0172     using pop_back = error_t;
0173     
0174     template<std::size_t Index, typename... NewArgs>
0175     using insert_args = error_t;
0176 
0177     template<std::size_t Index, std::size_t Count>
0178     using remove_args = error_t;
0179 
0180     template<std::size_t Index, typename... NewArgs>
0181     using replace_args = error_t;
0182 
0183     static constexpr qualifier_flags cv_flags = cv_of<T>::value;
0184     static constexpr qualifier_flags ref_flags = ref_of<T>::value;
0185     static constexpr qualifier_flags q_flags = cv_flags | ref_flags;
0186 
0187     using has_member_qualifiers = std::integral_constant<bool, q_flags != default_>;
0188     using is_const_member = std::integral_constant<bool, 0 < (cv_flags & const_)>;
0189     using is_volatile_member = std::integral_constant<bool, 0 < (cv_flags & volatile_)>;
0190     using is_cv_member = std::integral_constant<bool, cv_flags == (const_ | volatile_)>;
0191 
0192 #ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
0193     using is_reference_member = std::false_type;
0194     using is_lvalue_reference_member = std::false_type;
0195     using is_rvalue_reference_member = std::false_type;
0196 #else
0197     using is_reference_member = std::integral_constant<bool, 0 < ref_flags>;
0198     using is_lvalue_reference_member = std::integral_constant<bool, ref_flags == lref_>;
0199     using is_rvalue_reference_member = std::integral_constant<bool, ref_flags == rref_>;
0200 #endif //#ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
0201 
0202 };
0203 
0204 }}} // namespace boost::callable_traits::detail
0205 
0206 #endif // BOOST_CLBL_TRTS_DETAIL_DEFAULT_BOOST_CLBL_TRTS_HPP
0207