Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002 Copyright (c) 2016 Barrett Adair
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 HEADER GUARDS INTENTIONALLY OMITTED
0008 DO NOT INCLUDE THIS HEADER DIRECTLY
0009 
0010 macros used:
0011 
0012 BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS - the function-level qualifiers for the
0013     current inclusion (combinations of `const` `volatile` `&` `&&`, or nothing)
0014 
0015 BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE - the transaction_safe specifier for
0016     the current include (`transaction_safe` or nothing)
0017 
0018 BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE - `std::true_type` or `std::false_type`,
0019     tied on whether BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE is `transaction_safe`
0020 
0021 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER - `transaction_safe` when
0022     BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE is enabled, otherwise nothing
0023 
0024 BOOST_CLBL_TRTS_NOEXCEPT_SPEC - the noexcept specifier for
0025     the current include (`noexcept` or nothing)
0026 
0027 BOOST_CLBL_TRTS_IS_NOEXCEPT - `std::true_type` or `std::false_type`,
0028     tied on whether BOOST_CLBL_TRTS_NOEXCEPT_SPEC is `noexcept`
0029 
0030 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER - `noexcept` if
0031     BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES is defined, otherwise nothing
0032 
0033 */
0034 
0035 template<typename Return, typename... Args>
0036 struct function<Return(Args...)
0037     BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0038     BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0039     BOOST_CLBL_TRTS_NOEXCEPT_SPEC>
0040  : default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS> {
0041      
0042     static constexpr bool value = true;
0043     
0044     using traits = function;
0045 
0046     using return_type = Return;
0047 
0048     using arg_types = std::tuple<Args...>;
0049     using non_invoke_arg_types = arg_types;
0050 
0051     using type = Return(Args...)
0052         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0053         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0054         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0055 
0056     using function_type = Return(Args...);
0057 
0058     using qualified_function_type = Return(Args...)
0059         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0060         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0061         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0062 
0063     using remove_varargs = type;
0064 
0065     using add_varargs = Return (Args..., ...)
0066         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0067         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0068         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0069     
0070     using is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
0071 
0072     using remove_noexcept = Return(Args...)
0073         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0074         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE;
0075 
0076     using add_noexcept = Return(Args...)
0077         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0078         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0079         BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER;
0080 
0081     using is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
0082 
0083     using remove_transaction_safe = Return(Args...)
0084         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0085         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0086 
0087     using add_transaction_safe = Return(Args...)
0088         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0089         BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER
0090         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0091 
0092     using qualifiers = default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>;
0093     
0094     template<qualifier_flags Flags>
0095     using set_qualifiers = set_function_qualifiers<Flags, is_transaction_safe::value,
0096         is_noexcept::value, Return, Args...>;
0097     
0098     #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
0099 
0100     using add_member_lvalue_reference = abominable_functions_not_supported_on_this_compiler;
0101     using add_member_rvalue_reference = abominable_functions_not_supported_on_this_compiler;
0102     using add_member_const = abominable_functions_not_supported_on_this_compiler;
0103     using add_member_volatile = abominable_functions_not_supported_on_this_compiler;
0104     using add_member_cv = abominable_functions_not_supported_on_this_compiler;
0105 
0106     #else
0107 
0108     using add_member_lvalue_reference = set_qualifiers<
0109         collapse_flags<qualifiers::q_flags, lref_>::value>;
0110 
0111     using add_member_rvalue_reference = set_qualifiers<
0112         collapse_flags<qualifiers::q_flags, rref_>::value>;
0113 
0114     using add_member_const = set_qualifiers<qualifiers::q_flags | const_>;
0115 
0116     using add_member_volatile = set_qualifiers<qualifiers::q_flags | volatile_>;
0117 
0118     using add_member_cv = set_qualifiers<qualifiers::q_flags | cv_>;
0119 
0120     #endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
0121     
0122     using remove_member_reference = set_qualifiers<qualifiers::cv_flags>;
0123 
0124     using remove_member_const = set_qualifiers<
0125         qualifiers::ref_flags | remove_const_flag<qualifiers::cv_flags>::value>;
0126         
0127     using remove_member_volatile = set_qualifiers<
0128         qualifiers::ref_flags | remove_volatile_flag<qualifiers::cv_flags>::value>;
0129         
0130     using remove_member_cv = set_qualifiers<qualifiers::ref_flags>;
0131 
0132     template<typename U>
0133     using apply_member_pointer = add_member_pointer<type, U>;
0134     
0135     template<typename NewReturn>
0136     using apply_return = NewReturn(Args...)
0137         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0138         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0139         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0140     
0141     template<template<class...> class Container>
0142     using expand_args = Container<Args...>;
0143 
0144     using is_member_pointer = std::false_type;
0145 };
0146 
0147 
0148 template<typename Return, typename... Args>
0149 struct function<Return (Args..., ...)
0150     BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0151     BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0152     BOOST_CLBL_TRTS_NOEXCEPT_SPEC>
0153  : default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS> {
0154      
0155     static constexpr bool value = true;
0156     
0157     using has_varargs = std::true_type;
0158     using traits = function;
0159     using return_type = Return;
0160     using arg_types = std::tuple<Args...>;
0161 
0162     using type = Return (Args..., ...)
0163         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0164         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0165         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0166 
0167     using function_type = Return(Args..., ...);
0168 
0169     using qualified_function_type = Return(Args..., ...)
0170         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0171         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0172         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0173 
0174     using remove_varargs = Return (Args...)
0175         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0176         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0177         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0178 
0179     using add_varargs = type;
0180 
0181     using is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
0182 
0183     using remove_noexcept = Return(Args..., ...)
0184         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0185         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE;
0186 
0187     using add_noexcept = Return(Args..., ...)
0188         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0189         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0190         BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER;
0191 
0192     using is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
0193 
0194     using remove_transaction_safe = Return(Args..., ...)
0195         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0196         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0197 
0198     using add_transaction_safe = Return(Args..., ...)
0199         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0200         BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER
0201         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0202 
0203     using qualifiers = default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>;
0204     
0205     template<qualifier_flags Flags>
0206     using set_qualifiers = set_varargs_function_qualifiers<Flags, is_transaction_safe::value,
0207         is_noexcept::value, Return, Args...>;
0208     
0209     #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
0210 
0211     using add_member_lvalue_reference = abominable_functions_not_supported_on_this_compiler;
0212     using add_member_rvalue_reference = abominable_functions_not_supported_on_this_compiler;
0213     using add_member_const = abominable_functions_not_supported_on_this_compiler;
0214     using add_member_volatile = abominable_functions_not_supported_on_this_compiler;
0215     using add_member_cv = abominable_functions_not_supported_on_this_compiler;
0216 
0217     #else
0218 
0219     using add_member_lvalue_reference = set_qualifiers<
0220         collapse_flags<qualifiers::q_flags, lref_>::value>;
0221         
0222     using add_member_rvalue_reference = set_qualifiers<
0223         collapse_flags<qualifiers::q_flags, rref_>::value>;
0224         
0225     using add_member_const = set_qualifiers<qualifiers::q_flags | const_>;
0226 
0227     using add_member_volatile = set_qualifiers<qualifiers::q_flags | volatile_>;
0228 
0229     using add_member_cv = set_qualifiers<qualifiers::q_flags | cv_>;
0230     
0231     #endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
0232 
0233     using remove_member_reference = set_qualifiers<qualifiers::cv_flags>;
0234 
0235     using remove_member_const = set_qualifiers<
0236         qualifiers::ref_flags | remove_const_flag<qualifiers::cv_flags>::value>;
0237         
0238     using remove_member_volatile = set_qualifiers<
0239         qualifiers::ref_flags | remove_volatile_flag<qualifiers::cv_flags>::value>;
0240         
0241     using remove_member_cv = set_qualifiers<qualifiers::ref_flags>;
0242     
0243     template<typename U>
0244     using apply_member_pointer =
0245         Return( BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC U::*)(Args..., ...)
0246             BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0247             BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0248             BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0249         
0250     template<typename NewReturn>
0251     using apply_return = NewReturn(Args..., ...)
0252         BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
0253         BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
0254         BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
0255     
0256     template<template<class...> class Container>
0257     using expand_args = Container<Args...>;
0258     
0259     using is_member_pointer = std::false_type;
0260 };