remove_member_const.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #include <boost/callable_traits/detail/config.hpp>
  7. #ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
  8. int main(){ return 0; }
  9. #else
  10. //[ remove_member_const
  11. #include <type_traits>
  12. #include <boost/callable_traits/remove_member_const.hpp>
  13. namespace ct = boost::callable_traits;
  14. struct foo {};
  15. int main() {
  16. {
  17. using pmf = int(foo::*)() const;
  18. using expect = int(foo::*)();
  19. using test = ct::remove_member_const_t<pmf>;
  20. static_assert(std::is_same<test, expect>::value, "");
  21. } {
  22. using pmf = int(foo::*)() const &&;
  23. using expect = int(foo::*)() &&;
  24. using test = ct::remove_member_const_t<pmf>;
  25. static_assert(std::is_same<test, expect>::value, "");
  26. } {
  27. using pmf = int(foo::*)() const volatile &;
  28. using expect = int(foo::*)() volatile &;
  29. using test = ct::remove_member_const_t<pmf>;
  30. static_assert(std::is_same<test, expect>::value, "");
  31. } {
  32. using f = int() const;
  33. using expect = int();
  34. using test = ct::remove_member_const_t<f>;
  35. static_assert(std::is_same<test, expect>::value, "");
  36. }
  37. }
  38. //]
  39. #endif //#ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS