diff --git a/sprout/utility/enabler.hpp b/sprout/utility/enabler.hpp deleted file mode 100644 index d2123e45..00000000 --- a/sprout/utility/enabler.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef SPROUT_UTILITY_ENABLER_HPP -#define SPROUT_UTILITY_ENABLER_HPP - -#include - -namespace sprout { - extern void* enabler; -} // namespace sprout - -#endif // #ifndef SPROUT_UTILITY_ENABLER_HPP diff --git a/sprout/utility/enabler_if.hpp b/sprout/utility/enabler_if.hpp new file mode 100644 index 00000000..db0e4580 --- /dev/null +++ b/sprout/utility/enabler_if.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_UTILITY_ENABLER_IF_HPP +#define SPROUT_UTILITY_ENABLER_IF_HPP + +#include +#include + +namespace sprout { + // + // enabler_t + // enabler + // + typedef void* enabler_t; + extern enabler_t enabler; + // + // enabler_if + // + template + class enabler_if + : public std::enable_if + {}; +} // namespace sprout + +#endif // #ifndef SPROUT_UTILITY_ENABLER_IF_HPP diff --git a/sprout/utility/pack.hpp b/sprout/utility/pack.hpp index 7aa7e85b..c5f2b2a0 100644 --- a/sprout/utility/pack.hpp +++ b/sprout/utility/pack.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace sprout { // @@ -15,7 +15,7 @@ namespace sprout { template struct tppack_at_impl_1 { public: - typedef typename sprout::detail::tppack_at_impl::type type; + typedef typename sprout::detail::tppack_at_impl_1::type type; }; template struct tppack_at_impl_1<0, Head, Tail...> { @@ -24,18 +24,13 @@ namespace sprout { }; template< std::size_t N, - typename... Args, - typename std::enable_if<(N < sizeof...(Args))>::type*& = sprout::enabler + typename... Args > struct tppack_at_impl : public sprout::detail::tppack_at_impl_1 - {}; - template< - std::size_t N, - typename... Args, - typename std::enable_if<(N >= sizeof...(Args))>::type*& = sprout::enabler - > - struct tppack_at_impl {}; + { + static_assert(N < sizeof...(Args), "N < sizeof...(Args)"); + }; } // namespace detail template struct tppack_at @@ -51,7 +46,7 @@ namespace sprout { typename R, typename Head, typename... Tail, - typename std::enable_if::type*& = sprout::enabler + typename sprout::enabler_if::type = sprout::enabler > SPROUT_CONSTEXPR R fppack_at_impl(Head&& head, Tail&&... tail) { return sprout::forward(head); @@ -61,7 +56,7 @@ namespace sprout { typename R, typename Head, typename... Tail, - typename std::enable_if::type*& = sprout::enabler + typename sprout::enabler_if::type = sprout::enabler > SPROUT_CONSTEXPR R fppack_at_impl(Head&& head, Tail&&... tail) { return sprout::detail::fppack_at_impl(sprout::forward(tail)...);