LeviLamina
Loading...
Searching...
No Matches
copyable_function.h
1#pragma once
2
3#include "mc/platform/brstd/detail/function.h"
4
5namespace brstd {
6
7template <class Signature>
8class copyable_function : public detail::function::function_invoke<detail::function::DerivedType::Copyable, Signature> {
10
11public:
12 using base::base;
13 using base::operator();
14 copyable_function(copyable_function&&) noexcept = default;
15 copyable_function& operator=(copyable_function&&) noexcept = default;
16 copyable_function(copyable_function const&) = default;
17 copyable_function& operator=(copyable_function const&) = default;
18 template <class F>
19 requires std::is_constructible_v<copyable_function, F>
20 copyable_function& operator=(F&& f) {
21 *this = copyable_function{std::forward<F>(f)};
22 return *this;
23 }
24 friend void swap(copyable_function& f1, copyable_function& f2) noexcept { f1.swap(f2); }
25};
26} // namespace brstd
Definition copyable_function.h:8