diff --git a/include/libimp/countof.h b/include/libimp/countof.h index 2b77cf5..9298f8d 100644 --- a/include/libimp/countof.h +++ b/include/libimp/countof.h @@ -71,9 +71,11 @@ struct trait { } // namespace detail_countof -template > -constexpr auto countof(C const &c) noexcept(noexcept(R::countof(c))) { - return R::countof(c); +template , + typename R = decltype(T::countof(std::declval()))> +constexpr R countof(C const &c) noexcept(noexcept(T::countof(c))) { + return T::countof(c); } LIBIMP_NAMESPACE_END_ diff --git a/include/libimp/dataof.h b/include/libimp/dataof.h index a2d9049..a49bd36 100644 --- a/include/libimp/dataof.h +++ b/include/libimp/dataof.h @@ -80,13 +80,19 @@ struct trait { constexpr static T const *dataof(std::initializer_list il) noexcept { return il.begin(); } + template + constexpr static T const *dataof(T const *p) noexcept { + return p; + } }; } // namespace detail_dataof -template >>> -constexpr auto dataof(T &&c) noexcept(noexcept(R::dataof(std::forward(c)))) { - return R::dataof(std::forward(c)); +template >>, + typename R = decltype(T::dataof(std::declval()))> +constexpr R dataof(C &&c) noexcept(noexcept(T::dataof(std::forward(c)))) { + return T::dataof(std::forward(c)); } LIBIMP_NAMESPACE_END_