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_HAS_VARARGS_HPP
0010 #define BOOST_CLBL_TRTS_HAS_VARARGS_HPP
0011 
0012 #include <boost/callable_traits/detail/core.hpp>
0013 
0014 namespace boost { namespace callable_traits {
0015 
0016 //[ has_varargs_hpp
0017 /*`[section:ref_has_varargs has_varargs]
0018 [heading Header]
0019 ``#include <boost/callable_traits/has_varargs.hpp>``
0020 [heading Definition]
0021 */
0022 
0023 
0024 // inherits from either std::true_type or std::false_type
0025 template<typename T>
0026 struct has_varargs;
0027 
0028 //<-
0029 template<typename T>
0030 struct has_varargs : detail::traits<
0031     detail::shallow_decay<T>>::has_varargs {
0032 
0033     using type = typename detail::traits<
0034         detail::shallow_decay<T>>::has_varargs;
0035 };
0036 
0037 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
0038 
0039 template<typename T>
0040 struct has_varargs_v {
0041     static_assert(std::is_same<T, detail::dummy>::value,
0042         "Variable templates not supported on this compiler.");
0043 };
0044 
0045 #else
0046 //->
0047 // only available when variable templates are supported
0048 template<typename T>
0049 //<-
0050 BOOST_CLBL_TRAITS_INLINE_VAR
0051 //->
0052 constexpr bool has_varargs_v = //see below
0053 //<-
0054     detail::traits<detail::shallow_decay<T>>::has_varargs::value;
0055 
0056 #endif
0057 
0058 }} // namespace boost::callable_traits
0059 //->
0060 
0061 /*`
0062 [heading Constraints]
0063 * none
0064 
0065 [heading Behavior]
0066 * `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:
0067   * `T` is a function, function pointer, or function reference where the function's parameter list includes C-style variadics.
0068   * `T` is a pointer to a member function with C-style variadics in the parameter list.
0069   * `T` is a function object with a non-overloaded `operator()`, which has C-style variadics in the parameter list of its `operator()`.
0070 * On compilers that support variable templates, `has_varargs_v<T>` is equivalent to `has_varargs<T>::value`.
0071 
0072 [heading Input/Output Examples]
0073 [table
0074     [[`T`]                              [`has_varargs_v<T>`]]
0075     [[`void(...)`]                      [`true`]]
0076     [[`void(int, ...) const`]           [`true`]]
0077     [[`void(* volatile)(...)`]          [`true`]]
0078     [[`void(&)(...)`]                   [`true`]]
0079     [[`void(foo::*)(...) const`]        [`true`]]
0080     [[`void(*)()`]                      [`false`]]
0081     [[`void(*&)()`]                     [`false`]]
0082     [[`int`]                            [`false`]]
0083     [[`const int`]                      [`false`]]
0084     [[`int foo::*`]                     [`false`]]
0085 ]
0086 
0087 [heading Example Program]
0088 [import ../example/has_varargs.cpp]
0089 [has_varargs]
0090 [endsect]
0091 */
0092 //]
0093 
0094 #endif