remove_transaction_safe.hpp 2.7 KB

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