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)
9 #ifndef BOOST_CLBL_TRTS_ARGS_HPP
10 #define BOOST_CLBL_TRTS_ARGS_HPP
12 #include <boost/callable_traits/detail/core.hpp>
14 namespace boost { namespace callable_traits {
17 /*`[section:ref_args args]
19 ``#include <boost/callable_traits/args.hpp>``
23 template<typename T, template<class...> class Container = std::tuple>
24 using args_t = //see below
26 detail::try_but_fail_if_invalid<
27 typename detail::traits<
28 detail::shallow_decay<T>>::template expand_args<Container>,
29 cannot_expand_the_parameter_list_of_first_template_argument>;
33 template<typename T, template<class...> class Container,
34 typename = std::false_type>
37 template<typename T, template<class...> class Container>
38 struct args_impl <T, Container, typename std::is_same<
39 args_t<T, Container>, detail::dummy>::type>
41 using type = args_t<T, Container>;
48 template<class...> class Container = std::tuple>
49 struct args : detail::args_impl<T, Container> {};
52 }} // namespace boost::callable_traits
57 * `T` must be one of the following:
61 * member function pointer
63 * user-defined type with a non-overloaded `operator()`
64 * type of a non-generic lambda
67 * When the constraints are violated, a substitution failure occurs.
68 * When `T` is a function, function pointer, or function reference, the aliased type is `Container` instantiated with the function's parameter types.
69 * When `T` is a function object, the aliased type is `Container` instantiated with the `T::operator()` parameter types.
70 * 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.
71 * 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`.
73 [heading Input/Output Examples]
76 [[`void(float, char, int)`] [`std::tuple<float, char, int>`]]
77 [[`void(*)(float, char, int)`] [`std::tuple<float, char, int`]]
78 [[`void(&)(float, char, int)`] [`std::tuple<float, char, int`]]
79 [[`void(float, char, int) const &&`][`std::tuple<float, char, int>`]]
80 [[`void(*)()`] [`std::tuple<>`]]
81 [[`void(foo::* const &)(float, char, int)`] [`std::tuple<foo&, float, char, int>`]]
82 [[`int(foo::*)(int) const`] [`std::tuple<const foo&, int>`]]
83 [[`void(foo::*)() volatile &&`] [`std::tuple<volatile foo &&>`]]
84 [[`int foo::*`] [`std::tuple<const foo&>`]]
85 [[`const int foo::*`] [`std::tuple<const foo&>`]]
86 [[`int`] [(substitution failure)]]
87 [[`int (*const)()`] [(substitution failure)]]
90 [heading Example Program]
91 [import ../example/args.cpp]
97 #endif // #ifndef BOOST_CLBL_TRTS_ARGS_HPP