/*============================================================================= Copyright (c) 2011-2016 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_DATA_HPP #define SPROUT_CONTAINER_DATA_HPP #include #include #include #include namespace sprout { // // data // // effect: // sprout::container_range_traits::range_data(cont) // [default] // ADL callable range_data(cont) -> range_data(cont) // [default] // Container is T[N] -> pointer(cont) // otherwise, Container is not const // && sprout::is_const_cast_convertible // && callable sprout::as_const(cont).data() // -> const_cast(sprout::data(sprout::as_const(cont))) // cont.data() // template inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer data(Container& cont) { return sprout::container_range_traits::range_data(cont); } template inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer data(Container const& cont) { return sprout::container_range_traits::range_data(cont); } template inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer data(T (& arr)[N]) { return sprout::container_range_traits::range_data(arr); } template inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer data(T const (& arr)[N]) { return sprout::container_range_traits::range_data(arr); } // // cdata // template inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer cdata(Container const& cont) { return sprout::data(cont); } template inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer cdata(T const (& arr)[N]) { return sprout::data(arr); } } // namespace sprout #include #endif // #ifndef SPROUT_CONTAINER_DATA_HPP