remove_varargs.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*<-
  2. Copyright Barrett Adair 2016-2017
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt)
  5. ->*/
  6. //[ remove_varargs
  7. #include <type_traits>
  8. #include <boost/callable_traits/remove_varargs.hpp>
  9. namespace ct = boost::callable_traits;
  10. struct foo {};
  11. int main() {
  12. {
  13. using f = void(int, ...);
  14. using expect = void(int);
  15. using test = ct::remove_varargs_t<f>;
  16. static_assert(std::is_same<test, expect>::value, "");
  17. } {
  18. using fp = void(*)(...);
  19. using expect = void(*)();
  20. using test = ct::remove_varargs_t<fp>;
  21. static_assert(std::is_same<test, expect>::value, "");
  22. } {
  23. using fr = void(&)(const char*, ...);
  24. using expect = void(&)(const char*);
  25. using test = ct::remove_varargs_t<fr>;
  26. static_assert(std::is_same<test, expect>::value, "");
  27. } {
  28. using pmf = void(foo::*)(...) const;
  29. using expect = void(foo::*)() const;
  30. using test = ct::remove_varargs_t<pmf>;
  31. static_assert(std::is_same<test, expect>::value, "");
  32. }
  33. }
  34. //]