/*============================================================================= Copyright (c) 2011-2017 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_VALUE_HPP #define SPROUT_GENERATOR_NEXT_VALUE_HPP #include #include #include #include #include namespace sprout { namespace generators { // // next_value // // effect: // sprout::generators::generator_generate_traits::generate_next_value(t) // [default] // ADL callable generate_next_value(t) -> generate_next_value(t) // [default] // otherwise, callable t.next_value() -> t.next_value() // otherwise, T is InputIterator -> sprout::next(t) // otherwise, callable t() -> t() // otherwise -> sprout::generators::next_value(sprout::generators::next_generator(t)) // template inline SPROUT_CONSTEXPR decltype(sprout::generators::generator_generate_traits::type>::generate_next_value(std::declval())) next_value(T&& t) SPROUT_NOEXCEPT_IF_EXPR(sprout::generators::generator_generate_traits::type>::generate_next_value(std::declval())) { return sprout::generators::generator_generate_traits::type>::generate_next_value(SPROUT_FORWARD(T, t)); } } // namespace generators } // namespace sprout #endif // #ifndef SPROUT_GENERATOR_NEXT_VALUE_HPP