5 #ifndef EASTL_FUNCTION_H
6 #define EASTL_FUNCTION_H
8 #include <EASTL/internal/config.h>
10 #if defined(EA_PRAGMA_ONCE_SUPPORTED)
14 #include <EASTL/internal/function_detail.h>
23 #ifndef EASTL_FUNCTION_DEFAULT_CAPTURE_SSO_SIZE
24 #define EASTL_FUNCTION_DEFAULT_CAPTURE_SSO_SIZE (2 * sizeof(void*))
27 static_assert(EASTL_FUNCTION_DEFAULT_CAPTURE_SSO_SIZE >=
sizeof(
void*),
"functor storage must be able to hold at least a pointer!");
32 template <
typename R,
typename... Args>
38 using typename Base::result_type;
40 function() EA_NOEXCEPT =
default;
41 function(std::nullptr_t p) EA_NOEXCEPT
46 function(
const function& other)
51 function(
function&& other)
56 template <
typename Functor,
typename = EASTL_INTERNAL_FUNCTION_VALID_FUNCTION_ARGS(Functor, R, Args...,
Base,
function)>
57 function(Functor functor)
64 function& operator=(
const function& other)
66 Base::operator=(other);
70 function& operator=(
function&& other)
76 function& operator=(std::nullptr_t p) EA_NOEXCEPT
82 template <
typename Functor,
typename = EASTL_INTERNAL_FUNCTION_VALID_FUNCTION_ARGS(Functor, R, Args...,
Base,
function)>
83 function& operator=(Functor&& functor)
85 Base::operator=(eastl::forward<Functor>(functor));
89 template <
typename Functor>
96 void swap(
function& other) EA_NOEXCEPT
101 explicit operator bool()
const EA_NOEXCEPT
103 return Base::operator bool();
106 R operator ()(Args... args)
const
108 return Base::operator ()(eastl::forward<Args>(args)...);
111 #if EASTL_RTTI_ENABLED
112 const std::type_info& target_type()
const EA_NOEXCEPT
114 return Base::target_type();
117 template <
typename Functor>
118 Functor* target() EA_NOEXCEPT
120 return Base::target();
123 template <
typename Functor>
124 const Functor* target()
const EA_NOEXCEPT
126 return Base::target();
131 template <
typename R,
typename... Args>
132 bool operator==(
const function<R(Args...)>& f, std::nullptr_t) EA_NOEXCEPT
137 template <
typename R,
typename... Args>
138 bool operator==(std::nullptr_t,
const function<R(Args...)>& f) EA_NOEXCEPT
143 template <
typename R,
typename... Args>
144 bool operator!=(
const function<R(Args...)>& f, std::nullptr_t) EA_NOEXCEPT
149 template <
typename R,
typename... Args>
150 bool operator!=(std::nullptr_t,
const function<R(Args...)>& f) EA_NOEXCEPT
155 template <
typename R,
typename... Args>
156 void swap(
function<R(Args...)>& lhs,
function<R(Args...)>& rhs)
Definition: function.h:30
Definition: function_detail.h:416
reference_wrapper
Definition: functional_base.h:221
EA Standard Template Library.
Definition: algorithm.h:288
OutputIterator move(InputIterator first, InputIterator last, OutputIterator result)
Definition: copy_help.h:170