function_object.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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_DETAIL_FUNCTION_OBJECT_HPP
  7. #define BOOST_CLBL_TRTS_DETAIL_FUNCTION_OBJECT_HPP
  8. #include <boost/callable_traits/detail/pmf.hpp>
  9. #include <boost/callable_traits/detail/default_callable_traits.hpp>
  10. #include <boost/callable_traits/detail/forward_declarations.hpp>
  11. #include <boost/callable_traits/detail/utility.hpp>
  12. namespace boost { namespace callable_traits { namespace detail {
  13. template<typename T, typename Base>
  14. struct function_object : Base {
  15. using type = T;
  16. using error_t = error_type<T>;
  17. using function_type = typename Base::function_object_signature;
  18. using arg_types = typename Base::non_invoke_arg_types;
  19. using non_invoke_arg_types = arg_types;
  20. static constexpr const bool value = std::is_class<
  21. typename std::remove_reference<T>::type>::value;
  22. using traits = function_object;
  23. using class_type = error_t;
  24. using invoke_type = error_t;
  25. using remove_varargs = error_t;
  26. using add_varargs = error_t;
  27. using is_noexcept = typename Base::is_noexcept;
  28. using add_noexcept = error_t;
  29. using remove_noexcept = error_t;
  30. using is_transaction_safe = typename Base::is_transaction_safe;
  31. using add_transaction_safe = error_t;
  32. using remove_transaction_safe = error_t;
  33. using clear_args = error_t;
  34. template<template<class...> class Container>
  35. using expand_args = typename function<function_type>::template
  36. expand_args<Container>;
  37. template<template<class...> class Container, typename... RightArgs>
  38. using expand_args_left = typename function<function_type>::template
  39. expand_args_left<Container, RightArgs...>;
  40. template<template<class...> class Container, typename... LeftArgs>
  41. using expand_args_right = typename function<function_type>::template
  42. expand_args_right<Container, LeftArgs...>;
  43. template<typename C, typename U = T>
  44. using apply_member_pointer =
  45. typename std::remove_reference<U>::type C::*;
  46. template<typename>
  47. using apply_return = error_t;
  48. template<typename...>
  49. using push_front = error_t;
  50. template<typename...>
  51. using push_back = error_t;
  52. template<std::size_t ElementCount>
  53. using pop_args_front = error_t;
  54. template<std::size_t ElementCount>
  55. using pop_args_back = error_t;
  56. template<std::size_t Index, typename... NewArgs>
  57. using insert_args = error_t;
  58. template<std::size_t Index, std::size_t Count>
  59. using remove_args = error_t;
  60. template<std::size_t Index, typename... NewArgs>
  61. using replace_args = error_t;
  62. template<std::size_t Count>
  63. using pop_front = error_t;
  64. template<std::size_t Count>
  65. using pop_back = error_t;
  66. using remove_member_reference = error_t;
  67. using add_member_lvalue_reference = error_t;
  68. using add_member_rvalue_reference = error_t;
  69. using add_member_const = error_t;
  70. using add_member_volatile = error_t;
  71. using add_member_cv = error_t;
  72. using remove_member_const = error_t;
  73. using remove_member_volatile = error_t;
  74. using remove_member_cv = error_t;
  75. };
  76. template<typename T, typename U, typename Base>
  77. struct function_object <T U::*, Base>
  78. : default_callable_traits<> {};
  79. }}} // namespace boost::callable_traits::detail
  80. #endif // #ifndef BOOST_CLBL_TRTS_DETAIL_FUNCTION_OBJECT_HPP