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_ARGS_HPP
0010 #define BOOST_CLBL_TRTS_ARGS_HPP
0011 
0012 #include <boost/callable_traits/detail/core.hpp>
0013 
0014 namespace boost { namespace callable_traits {
0015 
0016 //[ args_hpp
0017 /*`[section:ref_args args]
0018 [heading Header]
0019 ``#include <boost/callable_traits/args.hpp>``
0020 [heading Definition]
0021 */
0022 
0023 template<typename T, template<class...> class Container = std::tuple>
0024 using args_t = //see below
0025 //<-
0026     detail::try_but_fail_if_invalid<
0027         typename detail::traits<
0028             detail::shallow_decay<T>>::template expand_args<Container>,
0029         cannot_expand_the_parameter_list_of_first_template_argument>;
0030 
0031 namespace detail {
0032 
0033     template<typename T, template<class...> class Container,
0034         typename = std::false_type>
0035     struct args_impl {};
0036 
0037     template<typename T, template<class...> class Container>
0038     struct args_impl <T, Container, typename std::is_same<
0039         args_t<T, Container>, detail::dummy>::type>
0040     {
0041         using type = args_t<T, Container>;
0042     };
0043 }
0044 
0045 //->
0046 
0047 template<typename T,
0048     template<class...> class Container = std::tuple>
0049 struct args : detail::args_impl<T, Container> {};
0050 
0051 //<-
0052 }} // namespace boost::callable_traits
0053 //->
0054 
0055 /*`
0056 [heading Constraints]
0057 * `T` must be one of the following:
0058   * function
0059   * function pointer
0060   * function reference
0061   * member function pointer
0062   * member data pointer
0063   * user-defined type with a non-overloaded `operator()`
0064   * type of a non-generic lambda
0065 
0066 [heading Behavior]
0067 * When the constraints are violated, a substitution failure occurs.
0068 * When `T` is a function, function pointer, or function reference, the aliased type is `Container` instantiated with the function's parameter types.
0069 * When `T` is a function object, the aliased type is `Container` instantiated with the `T::operator()` parameter types.
0070 * When `T` is a member function pointer, the aliased type is a `Container` instantiation, where the first type argument is a reference to the parent class of `T`, qualified according to the member qualifiers on `T`, such that the first type is equivalent to `boost::callable_traits::qualified_class_of_t<T>`. The subsequent type arguments, if any, are the parameter types of the member function.
0071 * When `T` is a member data pointer, the aliased type is `Container` with a single element, which is a `const` reference to the parent class of `T`.
0072 
0073 [heading Input/Output Examples]
0074 [table
0075     [[`T`]                              [`args_t<T>`]]
0076     [[`void(float, char, int)`]         [`std::tuple<float, char, int>`]]
0077     [[`void(*)(float, char, int)`]      [`std::tuple<float, char, int`]]
0078     [[`void(&)(float, char, int)`]      [`std::tuple<float, char, int`]]
0079     [[`void(float, char, int) const &&`][`std::tuple<float, char, int>`]]
0080     [[`void(*)()`]                      [`std::tuple<>`]]
0081     [[`void(foo::* const &)(float, char, int)`] [`std::tuple<foo&, float, char, int>`]]
0082     [[`int(foo::*)(int) const`]         [`std::tuple<const foo&, int>`]]
0083     [[`void(foo::*)() volatile &&`]     [`std::tuple<volatile foo &&>`]]
0084     [[`int foo::*`]                     [`std::tuple<const foo&>`]]
0085     [[`const int foo::*`]               [`std::tuple<const foo&>`]]
0086     [[`int`]                            [(substitution failure)]]
0087     [[`int (*const)()`]                 [(substitution failure)]]
0088 ]
0089 
0090 [heading Example Program]
0091 [import ../example/args.cpp]
0092 [args]
0093 [endsect]
0094 */
0095 //]
0096 
0097 #endif // #ifndef BOOST_CLBL_TRTS_ARGS_HPP