diff --git a/include/cib/config.hpp b/include/cib/config.hpp index 18de5505..20c5504f 100644 --- a/include/cib/config.hpp +++ b/include/cib/config.hpp @@ -9,6 +9,7 @@ #include #include +#include namespace cib { /** @@ -46,6 +47,12 @@ constexpr static detail::components components{}; template constexpr static detail::exports exports{}; +namespace detail { +template +using maybe_funcptr_t = + stdx::conditional_t, std::decay_t, T>; +} + /** * Extend a service with new functionality. * @@ -57,7 +64,7 @@ constexpr static detail::exports exports{}; */ template [[nodiscard]] CONSTEVAL auto extend(Args const &...args) { - return detail::extend{args...}; + return detail::extend...>{args...}; } template diff --git a/test/cib/nexus.cpp b/test/cib/nexus.cpp index 05a2f157..11abe93b 100644 --- a/test/cib/nexus.cpp +++ b/test/cib/nexus.cpp @@ -46,10 +46,14 @@ struct Foo { cib::extend>([]() { is_callback_invoked<2> = true; })); }; +namespace { +auto test_cb_1() { is_callback_invoked<1> = true; } +} // namespace + struct Bar { constexpr static auto config = cib::config( cib::extend>([]() { is_callback_invoked<0> = true; }), - cib::extend>([]() { is_callback_invoked<1> = true; })); + cib::extend>(test_cb_1)); }; struct Gorp {