1 /* 2 3 @Copyright Barrett Adair 2015-2017 4 5 Distributed under the Boost Software License, Version 1.0. 6 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 7 8 */ 9 10 #ifndef BOOST_CLBL_TRTS_REMOVE_VARARGS_HPP 11 #define BOOST_CLBL_TRTS_REMOVE_VARARGS_HPP 12 13 #include <boost/callable_traits/detail/core.hpp> 14 15 namespace boost { namespace callable_traits { 16 17 //[ remove_varargs_hpp 18 /*` 19 [section:ref_remove_varargs remove_varargs] 20 [heading Header] 21 ``#include <boost/callable_traits/remove_varargs.hpp>`` 22 [heading Definition] 23 */ 24 25 template<typename T> 26 using remove_varargs_t = //see below 27 //<- 28 detail::try_but_fail_if_invalid< 29 typename detail::traits<T>::remove_varargs, 30 varargs_are_illegal_for_this_type>; 31 32 namespace detail { 33 34 template<typename T, typename = std::false_type> 35 struct remove_varargs_impl {}; 36 37 template<typename T> 38 struct remove_varargs_impl <T, typename std::is_same< 39 remove_varargs_t<T>, detail::dummy>::type> 40 { 41 using type = remove_varargs_t<T>; 42 }; 43 } 44 45 //-> 46 47 template<typename T> 48 struct remove_varargs : detail::remove_varargs_impl<T> {}; 49 50 //<- 51 }} // namespace boost::callable_traits 52 //-> 53 54 /*` 55 [heading Constraints] 56 * `T` must be one of the following: 57 * function type 58 * function pointer type 59 * function reference type 60 * member function pointer type 61 * If `T` is a pointer, it may not be cv/ref qualified 62 63 [heading Behavior] 64 * A substitution failure occurs if the constraints are violated. 65 * Removes C-style variadics (`...`) from the signature of `T`, if present. 66 67 [heading Input/Output Examples] 68 [table 69 [[`T`] [`remove_varargs_t<T>`]] 70 [[`int(...)`] [`int()`]] 71 [[`int(int, ...)`] [`int(int)`]] 72 [[`int (&)(...)`] [`int(&)()`]] 73 [[`int (*)()`] [`int(*)()`]] 74 [[`int(foo::*)(...)`] [`int(foo::*)()`]] 75 [[`int(foo::*)(...) &`] [`int(foo::*)() &`]] 76 [[`int(foo::*)(...) &&`] [`int(foo::*)() &&`]] 77 [[`int(foo::*)(...) const`] [`int(foo::*)() const`]] 78 [[`int(foo::*)(...) transaction_safe`] [`int(foo::*)() transaction_safe`]] 79 [[`int`] [(substitution failure)]] 80 [[`int foo::*`] [(substitution failure)]] 81 [[`int (* const)()`] [(substitution failure)]] 82 ] 83 84 [heading Example Program] 85 [import ../example/remove_varargs.cpp] 86 [remove_varargs] 87 [endsect] 88 */ 89 //] 90 91 #endif // #ifndef BOOST_CLBL_TRTS_REMOVE_VARARGS_HPP 92