is_rvalue_reference_member.hpp 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. @Copyright Barrett Adair 2015-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. #ifndef BOOST_CLBL_TRTS_IS_RVALUE_REFERENCE_MEMBER_HPP
  7. #define BOOST_CLBL_TRTS_IS_RVALUE_REFERENCE_MEMBER_HPP
  8. #include <boost/callable_traits/detail/core.hpp>
  9. namespace boost { namespace callable_traits {
  10. //[ is_rvalue_reference_member_hpp
  11. /*`[section:ref_is_rvalue_reference_member is_rvalue_reference_member]
  12. [heading Header]
  13. ``#include <boost/callable_traits/is_rvalue_reference_member.hpp>``
  14. [heading Definition]
  15. */
  16. // inherits from either std::true_type or std::false_type
  17. template<typename T>
  18. struct is_rvalue_reference_member;
  19. //<-
  20. template<typename T>
  21. struct is_rvalue_reference_member : detail::traits<
  22. detail::shallow_decay<T>>::is_rvalue_reference_member {
  23. using type = typename detail::traits<
  24. detail::shallow_decay<T>>::is_rvalue_reference_member;
  25. };
  26. #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
  27. template<typename T>
  28. struct is_rvalue_reference_member_v {
  29. static_assert(std::is_same<T, detail::dummy>::value,
  30. "Variable templates not supported on this compiler.");
  31. };
  32. #else
  33. //->
  34. // only available when variable templates are supported
  35. template<typename T>
  36. //<-
  37. BOOST_CLBL_TRAITS_INLINE_VAR
  38. //->
  39. constexpr bool is_rvalue_reference_member_v = //see below
  40. //<-
  41. detail::traits<detail::shallow_decay<T>>::is_rvalue_reference_member::value;
  42. #endif
  43. }} // namespace boost::callable_traits
  44. //->
  45. /*`
  46. [heading Constraints]
  47. * none
  48. [heading Behavior]
  49. * `is_rvalue_reference_member<T>::value` is `true` when either:
  50. * `T` is a function type with a '&&' member qualifier
  51. * `T` is a pointer to a member function with a '&&' member qualifiers
  52. * `T` is a function object with a non-overloaded `operator()`, where the `operator()` has a '&&' member qualifier
  53. * On compilers that support variable templates, `is_rvalue_reference_member_v<T>` is equivalent to `is_rvalue_reference_member<T>::value`.
  54. [heading Input/Output Examples]
  55. [table
  56. [[`T`] [`is_rvalue_reference_member_v<T>`]]
  57. [[`int() const &&`] [`true`]]
  58. [[`int(foo::*)() &&`] [`true`]]
  59. [[`int() const`] [`false`]]
  60. [[`int() volatile`] [`false`]]
  61. [[`int(foo::* volatile)() const`] [`false`]]
  62. [[`int() const`] [`false`]]
  63. [[`int() volatile`] [`false`]]
  64. [[`int() &`] [`false`]]
  65. [[`int(*)()`] [`false`]]
  66. [[`int`] [`false`]]
  67. [[`int foo::*`] [`false`]]
  68. [[`const int foo::*`] [`false`]]
  69. ]
  70. [heading Example Program]
  71. [import ../example/is_rvalue_reference_member.cpp]
  72. [is_rvalue_reference_member]
  73. [endsect]
  74. */
  75. //]
  76. #endif // #ifndef BOOST_CLBL_TRTS_IS_RVALUE_REFERENCE_MEMBER_HPP