1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix container_traits for array-like classes

fix coding style algorithm/
This commit is contained in:
bolero-MURAKAMI 2012-09-29 17:10:46 +09:00
parent 06f1933220
commit 0c00166c5f
123 changed files with 1608 additions and 2224 deletions

View file

@ -4,6 +4,26 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/container/container_traits.hpp>
#include <sprout/adl/not_found.hpp>
namespace sprout_adl {
sprout::adl_not_found range_begin(...);
} // namespace sprout_adl
namespace sprout {
namespace container_detail {
template<typename Container>
inline typename sprout::container_traits<Container>::iterator
range_begin(Container& cont) {
return cont.begin();
}
template<typename Container>
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::const_iterator
range_begin(Container const& cont) {
return cont.begin();
}
} // namespace container_detail
} // namespace sprout
namespace sprout {
//
@ -12,19 +32,22 @@ namespace sprout {
template<typename Container>
inline typename sprout::container_traits<Container>::iterator
begin(Container& cont) {
return cont.begin();
using sprout::container_detail::range_begin;
using sprout_adl::range_begin;
return range_begin(cont);
}
template<typename Container>
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::const_iterator
begin(Container const& cont) {
using sprout::container_detail::range_begin;
using sprout_adl::range_begin;
return range_begin(cont);
}
template<typename T, std::size_t N>
inline typename sprout::container_traits<T[N]>::iterator
begin(T (& arr)[N]) {
return arr;
}
template<typename Container>
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::const_iterator
begin(Container const& cont) {
return cont.begin();
}
template<typename T, std::size_t N>
inline SPROUT_CONSTEXPR typename sprout::container_traits<T const[N]>::const_iterator
begin(T const (& arr)[N]) {
@ -37,7 +60,9 @@ namespace sprout {
template<typename Container>
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::const_iterator
cbegin(Container const& cont) {
return cont.begin();
using sprout::container_detail::range_begin;
using sprout_adl::range_begin;
return range_begin(cont);
}
template<typename T, std::size_t N>
inline SPROUT_CONSTEXPR typename sprout::container_traits<T const[N]>::const_iterator