diff --git a/include/boost/hana/detail/dependent_on.hpp b/include/boost/hana/detail/dependent_on.hpp index 9ea56da2c..22d72e936 100644 --- a/include/boost/hana/detail/dependent_on.hpp +++ b/include/boost/hana/detail/dependent_on.hpp @@ -11,11 +11,11 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_HANA_DETAIL_DEPENDENT_ON_HPP namespace boost { namespace hana { namespace detail { - template - struct dependent_on_impl { using type = T; }; + template + struct dependent_on { using type = T; }; - template - using dependent_on = typename dependent_on_impl::type; + template + using dependent_on_t = typename dependent_on::type; }}} // end namespace boost::hana::detail #endif // !BOOST_HANA_DETAIL_DEPENDENT_ON_HPP diff --git a/include/boost/hana/maybe.hpp b/include/boost/hana/maybe.hpp index c3a2d47bb..e2c0a256e 100644 --- a/include/boost/hana/maybe.hpp +++ b/include/boost/hana/maybe.hpp @@ -103,7 +103,7 @@ namespace boost { namespace hana { //! @snippet example/maybe/foldable.cpp main template struct Foldable::instance - : detail::dependent_on + : detail::dependent_on_t<(bool)sizeof...(Nothing), Foldable::mcd> { template static constexpr auto foldr_impl(F f, S s, M m) diff --git a/include/boost/hana/type.hpp b/include/boost/hana/type.hpp index 0ab878f5f..7f0919f0c 100644 --- a/include/boost/hana/type.hpp +++ b/include/boost/hana/type.hpp @@ -136,19 +136,19 @@ namespace boost { namespace hana { template struct metafunction_class { - // We need to delay the fetching of `f::apply` in case `f` is - // invalid because we want to stay SFINAE friendly. + // We use `dependent_on` to delay the fetching of `f::apply` in + // case `f` is invalid because we want to stay SFINAE friendly. template using apply = typename detail::dependent_on< - char[static_cast(sizeof...(xs)) + 1], f - >::template apply; + (bool)sizeof...(xs), f + >::type::template apply; template constexpr auto operator()(xs...) const -> decltype( type< typename detail::dependent_on< - char[static_cast(sizeof...(xs)) + 1], f - >::template apply::type + (bool)sizeof...(xs), f + >::type::template apply::type > ) { return {}; } };