/*============================================================================= Copyright (c) 2011-2019 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_GENERATOR_NEXT_GENERATOR_HPP #define SPROUT_GENERATOR_NEXT_GENERATOR_HPP #include #include #include #include #include namespace sprout { namespace generators { // // next_generator // // effect: // sprout::generators::generator_access_traits::get_next_generator(t) // [default] // ADL callable get_next_generator(t) -> get_next_generator(t) // [default] // T is not const // && callable sprout::as_const(t).next_generator() // -> sprout::const_reference_cast().next_generator())>(sprout::as_const(cont).next_generator()) // otherwise, callable t.next_generator() -> t.next_generator() // otherwise, T is InputIterator -> t // otherwise -> sprout::tuples::get<0>(t) // template inline SPROUT_CONSTEXPR decltype(sprout::generators::generator_access_traits::type>::get_next_generator(std::declval())) next_generator(T&& t) SPROUT_NOEXCEPT_IF_EXPR(sprout::generators::generator_access_traits::type>::get_next_generator(std::declval())) { return sprout::generators::generator_access_traits::type>::get_next_generator(SPROUT_FORWARD(T, t)); } } // namespace generators } // namespace sprout #endif // #ifndef SPROUT_GENERATOR_NEXT_GENERATOR_HPP