/*============================================================================= 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_CONTAINER_END_HPP #define SPROUT_CONTAINER_END_HPP #include #include #include #include namespace sprout { // // end // // effect: // sprout::container_range_traits::range_end(cont) // [default] // ADL callable range_end(cont) -> range_end(cont) // [default] // Container is T[N] -> iterator(cont) // otherwise, Container is not const // && sprout::is_const_iterator_cast_convertible // && (callable sprout::as_const(cont).end() // || ADL(without sprout) callable end(sprout::as_const(cont)) // ) // -> sprout::const_iterator_cast(sprout::end(sprout::as_const(cont))) // otherwise, callable cont.end() -> cont.end() // otherwise, ADL(without sprout) callable end(cont) -> end(cont) // otherwise -> std::end(cont) // template inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator end(Container& cont) { return sprout::container_range_traits::range_end(cont); } template inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator end(Container const& cont) { return sprout::container_range_traits::range_end(cont); } template inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator end(T (& arr)[N]) { return sprout::container_range_traits::range_end(arr); } template inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator end(T const (& arr)[N]) { return sprout::container_range_traits::range_end(arr); } // // cend // template inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator cend(Container const& cont) { return sprout::end(cont); } template inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator cend(T const (& arr)[N]) { return sprout::end(arr); } } // namespace sprout #include #endif // #ifndef SPROUT_CONTAINER_END_HPP