fix std::array adapt

This commit is contained in:
bolero-MURAKAMI 2014-07-13 02:07:17 +09:00
parent 28e9a4e5d9
commit 9b4ffacda6
2 changed files with 103 additions and 83 deletions

View file

@ -335,10 +335,12 @@ namespace sprout {
return *sprout::next(sprout::begin(cont), i); return *sprout::next(sprout::begin(cont), i);
} }
}; };
} // namespace detail
//
// container_range_traits_default
//
template<typename Container> template<typename Container>
struct container_range_traits struct container_range_traits_default
: public sprout::detail::container_range_traits_range_size_impl<Container> : public sprout::detail::container_range_traits_range_size_impl<Container>
, public sprout::detail::container_range_traits_range_empty_impl<Container> , public sprout::detail::container_range_traits_range_empty_impl<Container>
, public sprout::detail::container_range_traits_range_front_impl<Container> , public sprout::detail::container_range_traits_range_front_impl<Container>
@ -382,8 +384,11 @@ namespace sprout {
return cont.data(); return cont.data();
} }
}; };
//
// container_range_traits_const_default
//
template<typename Container> template<typename Container>
struct container_range_traits<Container const> { struct container_range_traits_const_default {
public: public:
// iterators: // iterators:
static SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator static SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
@ -422,6 +427,19 @@ namespace sprout {
return sprout::container_range_traits<Container>::range_data(cont); return sprout::container_range_traits<Container>::range_data(cont);
} }
}; };
} // namespace detail
//
// container_range_traits
//
template<typename Container>
struct container_range_traits
: public sprout::detail::container_range_traits_default<Container>
{};
template<typename Container>
struct container_range_traits<Container const>
: public sprout::detail::container_range_traits_const_default<Container>
{};
template<typename T, std::size_t N> template<typename T, std::size_t N>
struct container_range_traits<T[N]> { struct container_range_traits<T[N]> {

View file

@ -35,7 +35,9 @@ namespace sprout {
// container_range_traits // container_range_traits
// //
template<typename T, std::size_t N> template<typename T, std::size_t N>
struct container_range_traits<std::array<T, N> > { struct container_range_traits<std::array<T, N> >
: public sprout::detail::container_range_traits_default<std::array<T, N> >
{
public: public:
static SPROUT_CONSTEXPR typename sprout::container_traits<std::array<T, N> >::iterator static SPROUT_CONSTEXPR typename sprout::container_traits<std::array<T, N> >::iterator
range_begin(std::array<T, N>& cont) { range_begin(std::array<T, N>& cont) {