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