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_HAS_VARARGS_HPP
10 #define BOOST_CLBL_TRTS_HAS_VARARGS_HPP
12 #include <boost/callable_traits/detail/core.hpp>
14 namespace boost { namespace callable_traits {
17 /*`[section:ref_has_varargs has_varargs]
19 ``#include <boost/callable_traits/has_varargs.hpp>``
24 // inherits from either std::true_type or std::false_type
30 struct has_varargs : detail::traits<
31 detail::shallow_decay<T>>::has_varargs {
33 using type = typename detail::traits<
34 detail::shallow_decay<T>>::has_varargs;
37 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
40 struct has_varargs_v {
41 static_assert(std::is_same<T, detail::dummy>::value,
42 "Variable templates not supported on this compiler.");
47 // only available when variable templates are supported
50 BOOST_CLBL_TRAITS_INLINE_VAR
52 constexpr bool has_varargs_v = //see below
54 detail::traits<detail::shallow_decay<T>>::has_varargs::value;
58 }} // namespace boost::callable_traits
66 * `std::false_type` is inherited by `has_varargs<T>` and is aliased by `typename has_varargs<T>::type`, except when one of the following criteria is met, in which case `std::true_type` would be similarly inherited and aliased:
67 * `T` is a function, function pointer, or function reference where the function's parameter list includes C-style variadics.
68 * `T` is a pointer to a member function with C-style variadics in the parameter list.
69 * `T` is a function object with a non-overloaded `operator()`, which has C-style variadics in the parameter list of its `operator()`.
70 * On compilers that support variable templates, `has_varargs_v<T>` is equivalent to `has_varargs<T>::value`.
72 [heading Input/Output Examples]
74 [[`T`] [`has_varargs_v<T>`]]
75 [[`void(...)`] [`true`]]
76 [[`void(int, ...) const`] [`true`]]
77 [[`void(* volatile)(...)`] [`true`]]
78 [[`void(&)(...)`] [`true`]]
79 [[`void(foo::*)(...) const`] [`true`]]
80 [[`void(*)()`] [`false`]]
81 [[`void(*&)()`] [`false`]]
83 [[`const int`] [`false`]]
84 [[`int foo::*`] [`false`]]
87 [heading Example Program]
88 [import ../example/has_varargs.cpp]