/*============================================================================= Copyright (c) 2011-2013 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_CONTAINER_RANGE_TRAITS_HPP #define SPROUT_CONTAINER_CONTAINER_RANGE_TRAITS_HPP #include #include #include namespace sprout { // // container_range_traits // template struct container_range_traits { public: static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_begin(Container& cont) { return cont.begin(); } static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_begin(Container const& cont) { return cont.begin(); } static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_end(Container& cont) { return cont.end(); } static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_end(Container const& cont) { return cont.end(); } }; template struct container_range_traits { public: static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_begin(Container const& cont) { return sprout::container_range_traits::range_begin(cont); } static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_end(Container const& cont) { return sprout::container_range_traits::range_end(cont); } }; template struct container_range_traits { public: static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_begin(T (& arr)[N]) { typedef typename sprout::container_traits::iterator type; return type(arr); } static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_begin(T const (& arr)[N]) { typedef typename sprout::container_traits::iterator type; return type(arr); } static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_end(T (& arr)[N]) { typedef typename sprout::container_traits::iterator type; return type(arr) + N; } static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_end(T const (& arr)[N]) { typedef typename sprout::container_traits::iterator type; return type(arr) + N; } }; template struct container_range_traits { public: static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_begin(T const (& arr)[N]) { return sprout::container_range_traits::range_begin(arr); } static SPROUT_CONSTEXPR typename sprout::container_traits::const_iterator range_end(T const (& arr)[N]) { return sprout::container_range_traits::range_end(arr); } }; } // namespace sprout #endif // #ifndef SPROUT_CONTAINER_CONTAINER_RANGE_TRAITS_HPP