#ifndef SPROUT_GENERATOR_NEXT_GENERATOR_HPP #define SPROUT_GENERATOR_NEXT_GENERATOR_HPP #include #include #include #include #include #include namespace sprout_adl { sprout::not_found_via_adl get_next_generator(...); } // namespace sprout_adl namespace sprout_generator_detail { using sprout_adl::get_next_generator; template inline SPROUT_CONSTEXPR decltype(sprout::generators::generator_access_traits::get_next_generator(std::declval())) get_next_generator(Gen& gen) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::generators::generator_access_traits::get_next_generator(std::declval()))) { return sprout::generators::generator_access_traits::get_next_generator(gen); } template inline SPROUT_CONSTEXPR typename std::enable_if< !std::is_const::value && !std::is_volatile::value && !std::is_reference::value, decltype(sprout::generators::generator_access_traits::type>::get_next_generator(std::declval())) >::type get_next_generator(Gen&& gen) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::generators::generator_access_traits::type>::get_next_generator(std::declval()))) { return sprout::generators::generator_access_traits::get_next_generator(gen); } template inline SPROUT_CONSTEXPR decltype(sprout::generators::generator_access_traits::get_next_generator(std::declval())) get_next_generator(Gen const& gen) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::generators::generator_access_traits::get_next_generator(std::declval()))) { return sprout::generators::generator_access_traits::get_next_generator(gen); } template inline SPROUT_CONSTEXPR decltype(get_next_generator(std::declval())) call_get_next_generator(Gen& gen) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(get_next_generator(std::declval()))) { return get_next_generator(gen); } template inline SPROUT_CONSTEXPR typename std::enable_if< !std::is_const::value && !std::is_volatile::value && !std::is_reference::value, decltype(get_next_generator(std::declval())) >::type call_get_next_generator(Gen&& gen) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(get_next_generator(std::declval()))) { return get_next_generator(gen); } template inline SPROUT_CONSTEXPR decltype(get_next_generator(std::declval())) call_get_next_generator(Gen const& gen) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(get_next_generator(std::declval()))) { return get_next_generator(gen); } } // namespace sprout_generator_detail namespace sprout { namespace generators { // // next_generator // // effect: // ADL callable get_next_generator(t) -> get_next_generator(t) // otherwise -> sprout::generators::generator_access_traits::get_next_generator(t) // [default] // member callable t.next_generator() -> t.next_generator() // otherwise -> sprout::tuples::get<0>(t) // template inline SPROUT_CONSTEXPR decltype(sprout_generator_detail::call_get_next_generator(std::declval())) next_generator(T&& t) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout_generator_detail::call_get_next_generator(std::declval()))) { return sprout_generator_detail::call_get_next_generator(sprout::forward(t)); } } // namespace generators using sprout::generators::next_generator; } // namespace sprout #endif // #ifndef SPROUT_GENERATOR_NEXT_GENERATOR_HPP