6#ifndef SIMPLE_UTILITY_FUNCTIONAL_BASIC_CLOSURE_HPP
7#define SIMPLE_UTILITY_FUNCTIONAL_BASIC_CLOSURE_HPP
80 && std::is_object_v<T>;
88 template <
template <
class>
class T>
97 template <
template <
class>
class T>
106 template <function Fn,
template <
class>
class InvokePolicy,
template <
class>
class... OperatorPolicies>
119 template <
class... Args>
120 requires std::constructible_from<Fn, Args...>
121 explicit constexpr BasicClosure(Args&&... args)
noexcept(std::is_nothrow_constructible_v<Fn, Args...>)
122 : m_Fn{std::forward<Args>(args)...}
131 requires std::copy_constructible<Fn> =
default;
138 requires std::is_copy_assignable_v<Fn> =
default;
145 requires std::move_constructible<Fn> = default;
152 requires std::is_move_assignable_v<Fn> = default;
163 explicit constexpr operator const Fn&() const & noexcept
172 explicit constexpr operator Fn&() &
noexcept
181 explicit constexpr operator const Fn&&()
const &&
noexcept
183 return std::move(m_Fn);
190 explicit constexpr operator Fn&&() &&
noexcept
192 return std::move(m_Fn);
227 template <
class Fn,
template <
class>
class InvokePolicy,
template <
class>
class... OperatorPolicies>
236 template <
class Fn,
template <
class>
class InvokePolicy,
template <
class>
class... OperatorPolicies>
245 template <
class Fn,
template <
class>
class InvokePolicy,
template <
class>
class... OperatorPolicies>
257 template <
class Fn,
template <
class>
class InvokePolicy,
template <
class>
class... OperatorPolicies>
269 template <
class Fn,
template <
class>
class InvokePolicy,
template <
class>
class... OperatorPolicies>
281 template <
class Fn,
template <
class>
class InvokePolicy,
template <
class>
class... OperatorPolicies>
333 template <
class Fn,
template <
class>
class InvokePolicy,
template <
class>
class... OperatorPolicies>
336 template <
class NewFn>
351 template <
template <
class>
class Closure,
class Fn>
352 constexpr Closure<std::remove_cvref_t<Fn>>
envelop(
354 )
noexcept(std::is_nothrow_constructible_v<std::remove_cvref_t<Fn>, Fn>)
356 return Closure<std::remove_cvref_t<Fn>>{std::forward<Fn>(fn)};
The core class, wrapping one functional object and enabling a variety of composing operators for it.
Definition: BasicClosure.hpp:112
BasicClosure(const BasicClosure &)=default
Defaulted copy constructor.
constexpr BasicClosure(Args &&... args) noexcept(std::is_nothrow_constructible_v< Fn, Args... >)
Forwarding constructor, forwarding all of its arguments to its stored functional.
Definition: BasicClosure.hpp:121
BasicClosure(BasicClosure &&)=default
Defaulted move constructor.
Checks whether the T denotes an unqualified type.
Definition: stl_extensions.hpp:60
Determines whether the given type satisfies the constraints of a function type.
Definition: BasicClosure.hpp:79
Determines whether the given type satisfies the constraints of an invoke-policy.
Definition: BasicClosure.hpp:89
Determines whether the given type satisfies the constraints of a operator-policy.
Definition: BasicClosure.hpp:98
typename unwrap_functional< T >::type unwrap_functional_t
Convenient alias for the type member alias to unwrap_functional trait.
Definition: BasicClosure.hpp:292
constexpr unwrap_functional_t< Fn && > && forward_unwrapped(std::remove_reference_t< Fn > &fn) noexcept
Unwraps the functional if stored in a closure. Otherwise forwards as-is.
Definition: BasicClosure.hpp:307
constexpr Closure< std::remove_cvref_t< Fn > > envelop(Fn &&fn) noexcept(std::is_nothrow_constructible_v< std::remove_cvref_t< Fn >, Fn >)
Wraps the given functional into the given closure type.
Definition: BasicClosure.hpp:352
Definition: Arithmetic.hpp:13
Primary template, purposely undefined.
Definition: BasicClosure.hpp:325
Fn & type
Definition: BasicClosure.hpp:260
Fn && type
Definition: BasicClosure.hpp:284
const Fn & type
Definition: BasicClosure.hpp:248
const Fn && type
Definition: BasicClosure.hpp:272
Primary template for non BasicClosure types.
Definition: BasicClosure.hpp:217
T type
Definition: BasicClosure.hpp:218