1 #ifndef VCCC_FUNCTIONAL_DETAIL_BIND_BASE_HPP_
2 #define VCCC_FUNCTIONAL_DETAIL_BIND_BASE_HPP_
13 struct bind_object_ctor_tag{};
15 template<
typename Derived,
typename F,
typename... Args>
16 class bind_object_base {
17 template<
typename DerivedRef,
typename... U>
18 struct bind_invoke_result : Derived::template bind_invoke_result<DerivedRef, U&&...> {};
20 template<
typename DerivedRef,
typename... U>
21 struct bind_nothrow_invocable : Derived::template bind_nothrow_invocable<DerivedRef, U&&...> {};
23 using index_sequence = std::index_sequence_for<Args...>;
26 template<
typename F2,
typename... Args2>
27 constexpr bind_object_base(bind_object_ctor_tag, F2&& func, Args2&&... args)
28 : func_(
std::forward<F2>(func))
29 , args_(
std::forward<Args2>(args)...) {}
31 template<
typename... U>
32 constexpr
typename bind_invoke_result<Derived&, U&&...>::type
34 return call(*
this, std::forward<U>(args)...);
35 return Derived::call(derived(), index_sequence{}, std::forward<U>(args)...);
38 template<
typename... U>
39 constexpr
typename bind_invoke_result<
const Derived&, U&&...>::type
41 return call(*
this, std::forward<U>(args)...);
44 template<
typename... U>
45 constexpr
typename bind_invoke_result<Derived&&, U&&...>::type
47 return call(std::move(*
this), std::forward<U>(args)...);
50 template<
typename... U>
51 constexpr
typename bind_invoke_result<
const Derived&&, U&&...>::type
53 return call(std::move(*
this), std::forward<U>(args)...);
58 std::tuple<Args...> args_;
61 template<
typename Self,
typename... U>
62 static constexpr
typename bind_invoke_result<copy_cvref_t<Self&&, Derived>, U&&...>::type
63 call(Self&&
self, U&&... args) noexcept(bind_nothrow_invocable<copy_cvref_t<Self&&, Derived>, U&&...>::
value) {
64 return Derived::call(std::forward<Self>(
self).derived(), index_sequence{}, std::forward<U>(args)...);
67 Derived& derived() & {
return static_cast<Derived&
>(*this); }
68 const Derived& derived() const & {
return static_cast<const Derived&
>(*this); }
69 Derived&& derived() && {
return static_cast<Derived&&
>(*this); }
70 const Derived&& derived() const && {
return static_cast<const Derived&&
>(*this); }
Definition: matrix.hpp:495
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35