mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-01-23 20:46:37 +00:00
add container_range_traits default
This commit is contained in:
parent
0080332dd5
commit
8efb1a3748
23 changed files with 1822 additions and 1384 deletions
|
@ -22,7 +22,7 @@ namespace sprout {
|
||||||
// [default]
|
// [default]
|
||||||
// ADL callable range_at(cont, i) -> range_at(cont, i)
|
// ADL callable range_at(cont, i) -> range_at(cont, i)
|
||||||
// [default]
|
// [default]
|
||||||
// Container is T[N] -> cont[i]
|
// Container is T[N] -> cont[sprout::range_index_check(cont, i)]
|
||||||
// otherwise, Container is not const
|
// otherwise, Container is not const
|
||||||
// && sprout::is_const_cast_convertible<const_reference, reference>
|
// && sprout::is_const_cast_convertible<const_reference, reference>
|
||||||
// && (callable sprout::as_const(cont).at(i)
|
// && (callable sprout::as_const(cont).at(i)
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <boost/array.hpp>
|
#include <boost/array.hpp>
|
||||||
#include <sprout/config.hpp>
|
#include <sprout/config.hpp>
|
||||||
#include <type_traits>
|
|
||||||
#include <sprout/workaround/std/cstddef.hpp>
|
#include <sprout/workaround/std/cstddef.hpp>
|
||||||
#include <sprout/container/traits.hpp>
|
#include <sprout/container/traits.hpp>
|
||||||
#include <sprout/container/range_index_check.hpp>
|
#include <sprout/container/range_index_check.hpp>
|
||||||
|
@ -43,7 +42,7 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<typename T, std::size_t N>
|
template<typename T, std::size_t N>
|
||||||
struct container_traits<boost::array<T, N> >
|
struct container_traits<boost::array<T, N> >
|
||||||
: public sprout::detail::container_traits_default<boost::array<T, N> >
|
: public sprout::container_traits_default<boost::array<T, N> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef sprout::index_iterator<boost::array<T, N>&, true, sprout::detail::elems_subscript<> > iterator;
|
typedef sprout::index_iterator<boost::array<T, N>&, true, sprout::detail::elems_subscript<> > iterator;
|
||||||
|
@ -55,7 +54,7 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<typename T, std::size_t N>
|
template<typename T, std::size_t N>
|
||||||
struct container_range_traits<boost::array<T, N> >
|
struct container_range_traits<boost::array<T, N> >
|
||||||
: public sprout::detail::container_range_traits_default<boost::array<T, N> >
|
: public sprout::container_range_traits_default<boost::array<T, N> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// iterators:
|
// iterators:
|
||||||
|
|
|
@ -24,9 +24,6 @@
|
||||||
#include <sprout/tpp/algorithm/all_of.hpp>
|
#include <sprout/tpp/algorithm/all_of.hpp>
|
||||||
|
|
||||||
namespace sprout {
|
namespace sprout {
|
||||||
//
|
|
||||||
// container_construct_traits
|
|
||||||
//
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<typename Container, typename... Args>
|
template<typename Container, typename... Args>
|
||||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
@ -85,9 +82,13 @@ namespace sprout {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
//
|
||||||
|
// container_construct_traits
|
||||||
|
//
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
struct container_construct_traits_impl {
|
struct container_construct_traits {
|
||||||
public:
|
public:
|
||||||
typedef Container copied_type;
|
typedef Container copied_type;
|
||||||
public:
|
public:
|
||||||
|
@ -110,12 +111,6 @@ namespace sprout {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace detail
|
|
||||||
|
|
||||||
template<typename Container>
|
|
||||||
struct container_construct_traits
|
|
||||||
: public sprout::detail::container_construct_traits_impl<Container>
|
|
||||||
{};
|
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
struct container_construct_traits<Container const>
|
struct container_construct_traits<Container const>
|
||||||
: public sprout::container_construct_traits<Container>
|
: public sprout::container_construct_traits<Container>
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -392,7 +392,6 @@ namespace sprout {
|
||||||
sprout::detail::is_array_like<Container>::value
|
sprout::detail::is_array_like<Container>::value
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
//
|
//
|
||||||
// container_nosy_fixed_size
|
// container_nosy_fixed_size
|
||||||
//
|
//
|
||||||
|
@ -414,52 +413,6 @@ namespace sprout {
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
//
|
|
||||||
// container_traits_default
|
|
||||||
//
|
|
||||||
template<typename Container>
|
|
||||||
struct container_traits_default
|
|
||||||
: public sprout::detail::container_nosy_value_type<Container>
|
|
||||||
, public sprout::detail::container_nosy_iterator<Container>
|
|
||||||
, public sprout::detail::container_nosy_const_iterator<Container>
|
|
||||||
, public sprout::detail::container_nosy_reference<Container>
|
|
||||||
, public sprout::detail::container_nosy_const_reference<Container>
|
|
||||||
, public sprout::detail::container_nosy_size_type<Container>
|
|
||||||
, public sprout::detail::container_nosy_difference_type<Container>
|
|
||||||
, public sprout::detail::container_nosy_pointer<Container>
|
|
||||||
, public sprout::detail::container_nosy_const_pointer<Container>
|
|
||||||
, public sprout::detail::container_nosy_static_size<Container>
|
|
||||||
, public sprout::detail::container_nosy_fixed_size<Container>
|
|
||||||
{};
|
|
||||||
template<typename T, std::size_t N>
|
|
||||||
struct container_traits_default<T[N]> {
|
|
||||||
public:
|
|
||||||
typedef T value_type;
|
|
||||||
#if SPROUT_USE_PTR_INDEX_ITERATOR_IMPLEMENTATION
|
|
||||||
typedef sprout::ptr_index_iterator<T, true> iterator;
|
|
||||||
typedef sprout::ptr_index_iterator<T const, true> const_iterator;
|
|
||||||
#else
|
|
||||||
typedef T* iterator;
|
|
||||||
typedef T const* const_iterator;
|
|
||||||
#endif
|
|
||||||
typedef T& reference;
|
|
||||||
typedef T const& const_reference;
|
|
||||||
typedef std::size_t size_type;
|
|
||||||
typedef std::ptrdiff_t difference_type;
|
|
||||||
typedef T* pointer;
|
|
||||||
typedef T const* const_pointer;
|
|
||||||
public:
|
|
||||||
SPROUT_STATIC_CONSTEXPR size_type static_size = N;
|
|
||||||
public:
|
|
||||||
static SPROUT_CONSTEXPR size_type
|
|
||||||
fixed_size() SPROUT_NOEXCEPT {
|
|
||||||
return static_size;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
template<typename T, std::size_t N>
|
|
||||||
SPROUT_CONSTEXPR_OR_CONST typename sprout::detail::container_traits_default<T[N]>::size_type
|
|
||||||
sprout::detail::container_traits_default<T[N]>::static_size;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// container_traits_const_default
|
// container_traits_const_default
|
||||||
//
|
//
|
||||||
|
@ -479,12 +432,87 @@ namespace sprout {
|
||||||
{};
|
{};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
|
//
|
||||||
|
// container_value_type_default
|
||||||
|
// container_iterator_default
|
||||||
|
// container_const_iterator_default
|
||||||
|
// container_reference_default
|
||||||
|
// container_const_reference_default
|
||||||
|
// container_size_type_default
|
||||||
|
// container_difference_type_default
|
||||||
|
// container_pointer_default
|
||||||
|
// container_const_pointer_default
|
||||||
|
// container_static_size_default
|
||||||
|
// container_fixed_size_default
|
||||||
|
//
|
||||||
|
template<typename Container>
|
||||||
|
struct container_value_type_default
|
||||||
|
: public sprout::detail::container_nosy_value_type<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_iterator_default
|
||||||
|
: public sprout::detail::container_nosy_iterator<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_const_iterator_default
|
||||||
|
: public sprout::detail::container_nosy_const_iterator<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_reference_default
|
||||||
|
: public sprout::detail::container_nosy_reference<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_const_reference_default
|
||||||
|
: public sprout::detail::container_nosy_const_reference<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_size_type_default
|
||||||
|
: public sprout::detail::container_nosy_size_type<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_difference_type_default
|
||||||
|
: public sprout::detail::container_nosy_difference_type<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_pointer_default
|
||||||
|
: public sprout::detail::container_nosy_pointer<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_const_pointer_default
|
||||||
|
: public sprout::detail::container_nosy_const_pointer<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_static_size_default
|
||||||
|
: public sprout::detail::container_nosy_static_size<Container>
|
||||||
|
{};
|
||||||
|
template<typename Container>
|
||||||
|
struct container_fixed_size_default
|
||||||
|
: public sprout::detail::container_nosy_fixed_size<Container>
|
||||||
|
{};
|
||||||
|
//
|
||||||
|
// container_traits_default
|
||||||
|
//
|
||||||
|
template<typename Container>
|
||||||
|
struct container_traits_default
|
||||||
|
: public sprout::container_value_type_default<Container>
|
||||||
|
, public sprout::container_iterator_default<Container>
|
||||||
|
, public sprout::container_const_iterator_default<Container>
|
||||||
|
, public sprout::container_reference_default<Container>
|
||||||
|
, public sprout::container_const_reference_default<Container>
|
||||||
|
, public sprout::container_size_type_default<Container>
|
||||||
|
, public sprout::container_difference_type_default<Container>
|
||||||
|
, public sprout::container_pointer_default<Container>
|
||||||
|
, public sprout::container_const_pointer_default<Container>
|
||||||
|
, public sprout::container_static_size_default<Container>
|
||||||
|
, public sprout::container_fixed_size_default<Container>
|
||||||
|
{};
|
||||||
|
|
||||||
//
|
//
|
||||||
// container_traits
|
// container_traits
|
||||||
//
|
//
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
struct container_traits
|
struct container_traits
|
||||||
: public sprout::detail::container_traits_default<Container>
|
: public sprout::container_traits_default<Container>
|
||||||
{};
|
{};
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
struct container_traits<Container const>
|
struct container_traits<Container const>
|
||||||
|
@ -492,9 +520,33 @@ namespace sprout {
|
||||||
{};
|
{};
|
||||||
|
|
||||||
template<typename T, std::size_t N>
|
template<typename T, std::size_t N>
|
||||||
struct container_traits<T[N]>
|
struct container_traits<T[N]> {
|
||||||
: public sprout::detail::container_traits_default<T[N]>
|
public:
|
||||||
{};
|
typedef T value_type;
|
||||||
|
#if SPROUT_USE_PTR_INDEX_ITERATOR_IMPLEMENTATION
|
||||||
|
typedef sprout::ptr_index_iterator<T, true> iterator;
|
||||||
|
typedef sprout::ptr_index_iterator<T const, true> const_iterator;
|
||||||
|
#else
|
||||||
|
typedef T* iterator;
|
||||||
|
typedef T const* const_iterator;
|
||||||
|
#endif
|
||||||
|
typedef T& reference;
|
||||||
|
typedef T const& const_reference;
|
||||||
|
typedef std::size_t size_type;
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
typedef T* pointer;
|
||||||
|
typedef T const* const_pointer;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR size_type static_size = N;
|
||||||
|
public:
|
||||||
|
static SPROUT_CONSTEXPR size_type
|
||||||
|
fixed_size() SPROUT_NOEXCEPT {
|
||||||
|
return static_size;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template<typename T, std::size_t N>
|
||||||
|
SPROUT_CONSTEXPR_OR_CONST typename sprout::container_traits<T[N]>::size_type
|
||||||
|
sprout::container_traits<T[N]>::static_size;
|
||||||
template<typename T, std::size_t N>
|
template<typename T, std::size_t N>
|
||||||
struct container_traits<T const[N]>
|
struct container_traits<T const[N]>
|
||||||
: public sprout::detail::container_traits_const_default<T[N]>
|
: public sprout::detail::container_traits_const_default<T[N]>
|
||||||
|
|
155
sprout/container/detail/range_at.hpp
Normal file
155
sprout/container/detail/range_at.hpp
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_AT_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_AT_HPP
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/type_traits/is_const_cast_convertible.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/container/detail/range_begin.hpp>
|
||||||
|
#include <sprout/container/detail/range_subscript_at.hpp>
|
||||||
|
#include <sprout/iterator/operation.hpp>
|
||||||
|
#include <sprout/utility/as_const.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl range_at(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_at_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().at(std::declval<typename sprout::container_traits<U>::size_type>()))>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_at_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_at
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_at
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_at_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_substitutable_const_at
|
||||||
|
: public sprout::bool_constant<
|
||||||
|
sprout::is_const_cast_convertible<
|
||||||
|
typename sprout::container_traits<T const>::reference,
|
||||||
|
typename sprout::container_traits<T>::reference
|
||||||
|
>::value
|
||||||
|
&& (
|
||||||
|
sprout::detail::has_mem_at<T const>::value
|
||||||
|
|| sprout::detail::has_mem_subscript<T const>::value
|
||||||
|
|| sprout::detail::has_mem_begin<T const>::value
|
||||||
|
|| sprout::detail::has_adl_begin_without_sprout<T const&>::value
|
||||||
|
)
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::is_substitutable_const_at<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_at_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
typedef typename sprout::container_traits<Container>::reference type;
|
||||||
|
return const_cast<type>(sprout::at(sprout::as_const(cont), i));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_at<Container>::value
|
||||||
|
&& sprout::detail::has_mem_at<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_at_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return cont.at(i);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_at<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_at<Container>::value
|
||||||
|
&& sprout::detail::has_mem_subscript<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_at_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return cont[sprout::range_index_check(cont, i)];
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_at<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_at<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_subscript<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_at_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return *sprout::next(sprout::begin(cont), sprout::range_index_check(cont, i));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_at<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::reference
|
||||||
|
>::type
|
||||||
|
range_at_impl(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return cont.at(i);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_at<Container const>::value
|
||||||
|
&& sprout::detail::has_mem_subscript<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container const>::reference
|
||||||
|
>::type
|
||||||
|
range_at_impl(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return cont[sprout::range_index_check(cont, i)];
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_at<Container const>::value
|
||||||
|
&& !sprout::detail::has_mem_subscript<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container const>::reference
|
||||||
|
>::type
|
||||||
|
range_at_impl(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return *sprout::next(sprout::begin(cont), sprout::range_index_check(cont, i));
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::reference
|
||||||
|
range_at(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return sprout::detail::range_at_impl(cont, i);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::reference
|
||||||
|
range_at(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return sprout::detail::range_at_impl(cont, i);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_AT_HPP
|
129
sprout/container/detail/range_back.hpp
Normal file
129
sprout/container/detail/range_back.hpp
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_BACK_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_BACK_HPP
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/type_traits/is_const_cast_convertible.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/container/detail/range_begin.hpp>
|
||||||
|
#include <sprout/iterator/operation.hpp>
|
||||||
|
#include <sprout/utility/as_const.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl range_back(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_back_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().back())>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_back_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_back
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_back
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_back_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_substitutable_const_back
|
||||||
|
: public sprout::bool_constant<
|
||||||
|
sprout::is_const_cast_convertible<
|
||||||
|
typename sprout::container_traits<T const>::reference,
|
||||||
|
typename sprout::container_traits<T>::reference
|
||||||
|
>::value
|
||||||
|
&& (
|
||||||
|
sprout::detail::has_mem_back<T const>::value
|
||||||
|
|| sprout::detail::has_mem_begin<T const>::value
|
||||||
|
|| sprout::detail::has_adl_begin_without_sprout<T const&>::value
|
||||||
|
)
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::is_substitutable_const_back<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_back_impl(Container& cont) {
|
||||||
|
typedef typename sprout::container_traits<Container>::reference type;
|
||||||
|
return const_cast<type>(sprout::back(sprout::as_const(cont)));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_back<Container>::value
|
||||||
|
&& sprout::detail::has_mem_back<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_back_impl(Container& cont) {
|
||||||
|
return cont.back();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_back<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_back<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_back_impl(Container& cont) {
|
||||||
|
return *sprout::begin(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_back<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::reference
|
||||||
|
>::type
|
||||||
|
range_back_impl(Container const& cont) {
|
||||||
|
return cont.back();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_back<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::reference
|
||||||
|
>::type
|
||||||
|
range_back_impl(Container const& cont) {
|
||||||
|
return *sprout::next(sprout::begin(cont), sprout::size(cont) - 1);
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::reference
|
||||||
|
range_back(Container& cont) {
|
||||||
|
return sprout::detail::range_back_impl(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::reference
|
||||||
|
range_back(Container const& cont) {
|
||||||
|
return sprout::detail::range_back_impl(cont);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_BACK_HPP
|
199
sprout/container/detail/range_begin.hpp
Normal file
199
sprout/container/detail/range_begin.hpp
Normal file
|
@ -0,0 +1,199 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_BEGIN_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_BEGIN_HPP
|
||||||
|
|
||||||
|
#include <iterator>
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/type_traits/is_within_namespace_sprout.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/iterator/const_iterator_cast.hpp>
|
||||||
|
#include <sprout/utility/as_const.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl begin(...);
|
||||||
|
sprout::not_found_via_adl range_begin(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
using sprout_adl::begin;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct has_adl_begin_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename R = typename sprout::identity<decltype(begin(std::declval<U>()))>::type
|
||||||
|
>
|
||||||
|
static sprout::is_found_via_adl<R> test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
||||||
|
range_adl_begin(Container& cont) {
|
||||||
|
return begin(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
||||||
|
range_adl_begin(Container const& cont) {
|
||||||
|
return begin(cont);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout_container_range_detail::has_adl_begin_test<T>::test(0))>::type>
|
||||||
|
struct has_adl_begin
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_adl_begin
|
||||||
|
: public sprout::identity<decltype(sprout_container_range_detail::has_adl_begin_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
template<typename T, bool = sprout::is_within_namespace_sprout<T>::value>
|
||||||
|
struct has_adl_begin_without_sprout
|
||||||
|
: public sprout::false_type
|
||||||
|
{};
|
||||||
|
template<typename T>
|
||||||
|
struct has_adl_begin_without_sprout<T, false>
|
||||||
|
: public sprout::detail::has_adl_begin<T>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_begin_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().begin())>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_begin_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_begin
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_begin
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_begin_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_substitutable_const_begin
|
||||||
|
: public sprout::bool_constant<
|
||||||
|
sprout::is_const_iterator_cast_convertible<
|
||||||
|
typename sprout::container_traits<T const>::iterator,
|
||||||
|
typename sprout::container_traits<T>::iterator
|
||||||
|
>::value
|
||||||
|
&& (
|
||||||
|
sprout::detail::has_mem_begin<T const>::value
|
||||||
|
|| sprout::detail::has_adl_begin_without_sprout<T const&>::value
|
||||||
|
)
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::is_substitutable_const_begin<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_begin_impl(Container& cont) {
|
||||||
|
typedef typename sprout::container_traits<Container>::iterator type;
|
||||||
|
return sprout::const_iterator_cast<type>(sprout::begin(sprout::as_const(cont)));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_begin<Container>::value
|
||||||
|
&& sprout::detail::has_mem_begin<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_begin_impl(Container& cont) {
|
||||||
|
return cont.begin();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_begin<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_begin<Container>::value
|
||||||
|
&& sprout::detail::has_adl_begin_without_sprout<Container&>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_begin_impl(Container& cont) {
|
||||||
|
return sprout_container_range_detail::range_adl_begin(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_begin<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_begin<Container>::value
|
||||||
|
&& !sprout::detail::has_adl_begin_without_sprout<Container&>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_begin_impl(Container& cont) {
|
||||||
|
return std::begin(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_begin<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::iterator
|
||||||
|
>::type
|
||||||
|
range_begin_impl(Container const& cont) {
|
||||||
|
return cont.begin();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_begin<Container const>::value
|
||||||
|
&& sprout::detail::has_adl_begin_without_sprout<Container const&>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container const>::iterator
|
||||||
|
>::type
|
||||||
|
range_begin_impl(Container const& cont) {
|
||||||
|
return sprout_container_range_detail::range_adl_begin(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_begin<Container const>::value
|
||||||
|
&& !sprout::detail::has_adl_begin_without_sprout<Container const&>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container const>::iterator
|
||||||
|
>::type
|
||||||
|
range_begin_impl(Container const& cont) {
|
||||||
|
return std::begin(cont);
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
||||||
|
range_begin(Container& cont) {
|
||||||
|
return sprout::detail::range_begin_impl(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
||||||
|
range_begin(Container const& cont) {
|
||||||
|
return sprout::detail::range_begin_impl(cont);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_BEGIN_HPP
|
99
sprout/container/detail/range_data.hpp
Normal file
99
sprout/container/detail/range_data.hpp
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_DATA_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_DATA_HPP
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/type_traits/is_const_cast_convertible.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/utility/as_const.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl range_data(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_data_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().data())>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_data_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_data
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_data
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_data_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_substitutable_const_data
|
||||||
|
: public sprout::bool_constant<
|
||||||
|
sprout::is_const_cast_convertible<
|
||||||
|
typename sprout::container_traits<T const>::pointer,
|
||||||
|
typename sprout::container_traits<T>::pointer
|
||||||
|
>::value
|
||||||
|
&& sprout::detail::has_mem_data<T const>::value
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::is_substitutable_const_data<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::pointer
|
||||||
|
>::type
|
||||||
|
range_data_impl(Container& cont) {
|
||||||
|
typedef typename sprout::container_traits<Container>::pointer type;
|
||||||
|
return const_cast<type>(sprout::data(sprout::as_const(cont)));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_data<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::pointer
|
||||||
|
>::type
|
||||||
|
range_data_impl(Container& cont) {
|
||||||
|
return cont.data();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::pointer
|
||||||
|
range_data_impl(Container const& cont) {
|
||||||
|
return cont.data();
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::pointer
|
||||||
|
range_data(Container& cont) {
|
||||||
|
return sprout::detail::range_data_impl(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::pointer
|
||||||
|
range_data(Container const& cont) {
|
||||||
|
return sprout::detail::range_data_impl(cont);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_DATA_HPP
|
76
sprout/container/detail/range_empty.hpp
Normal file
76
sprout/container/detail/range_empty.hpp
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_EMPTY_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_EMPTY_HPP
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl range_empty(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_empty_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().empty())>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_empty_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_empty
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_empty
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_empty_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_empty<Container const>::value,
|
||||||
|
bool
|
||||||
|
>::type
|
||||||
|
range_empty_impl(Container const& cont) {
|
||||||
|
return cont.empty();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_empty<Container const>::value,
|
||||||
|
bool
|
||||||
|
>::type
|
||||||
|
range_empty_impl(Container const& cont) {
|
||||||
|
return sprout::size(cont) == 0;
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR bool
|
||||||
|
range_empty(Container const& cont) {
|
||||||
|
return sprout::detail::range_empty_impl(cont);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_EMPTY_HPP
|
199
sprout/container/detail/range_end.hpp
Normal file
199
sprout/container/detail/range_end.hpp
Normal file
|
@ -0,0 +1,199 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_END_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_END_HPP
|
||||||
|
|
||||||
|
#include <iterator>
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/type_traits/is_within_namespace_sprout.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/iterator/const_iterator_cast.hpp>
|
||||||
|
#include <sprout/utility/as_const.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl end(...);
|
||||||
|
sprout::not_found_via_adl range_end(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
using sprout_adl::end;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct has_adl_end_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename R = typename sprout::identity<decltype(end(std::declval<U>()))>::type
|
||||||
|
>
|
||||||
|
static sprout::is_found_via_adl<R> test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
||||||
|
range_adl_end(Container& cont) {
|
||||||
|
return end(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
||||||
|
range_adl_end(Container const& cont) {
|
||||||
|
return end(cont);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout_container_range_detail::has_adl_end_test<T>::test(0))>::type>
|
||||||
|
struct has_adl_end
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_adl_end
|
||||||
|
: public sprout::identity<decltype(sprout_container_range_detail::has_adl_end_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
template<typename T, bool = sprout::is_within_namespace_sprout<T>::value>
|
||||||
|
struct has_adl_end_without_sprout
|
||||||
|
: public sprout::false_type
|
||||||
|
{};
|
||||||
|
template<typename T>
|
||||||
|
struct has_adl_end_without_sprout<T, false>
|
||||||
|
: public sprout::detail::has_adl_end<T>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_end_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().end())>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_end_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_end
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_end
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_end_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_substitutable_const_end
|
||||||
|
: public sprout::bool_constant<
|
||||||
|
sprout::is_const_iterator_cast_convertible<
|
||||||
|
typename sprout::container_traits<T const>::iterator,
|
||||||
|
typename sprout::container_traits<T>::iterator
|
||||||
|
>::value
|
||||||
|
&& (
|
||||||
|
sprout::detail::has_mem_end<T const>::value
|
||||||
|
|| sprout::detail::has_adl_end_without_sprout<T const&>::value
|
||||||
|
)
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::is_substitutable_const_end<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_end_impl(Container& cont) {
|
||||||
|
typedef typename sprout::container_traits<Container>::iterator type;
|
||||||
|
return sprout::const_iterator_cast<type>(sprout::end(sprout::as_const(cont)));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_end<Container>::value
|
||||||
|
&& sprout::detail::has_mem_end<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_end_impl(Container& cont) {
|
||||||
|
return cont.end();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_end<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_end<Container>::value
|
||||||
|
&& sprout::detail::has_adl_end_without_sprout<Container&>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_end_impl(Container& cont) {
|
||||||
|
return sprout_container_range_detail::range_adl_end(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_end<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_end<Container>::value
|
||||||
|
&& !sprout::detail::has_adl_end_without_sprout<Container&>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_end_impl(Container& cont) {
|
||||||
|
return std::end(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_end<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::iterator
|
||||||
|
>::type
|
||||||
|
range_end_impl(Container const& cont) {
|
||||||
|
return cont.end();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_end<Container const>::value
|
||||||
|
&& sprout::detail::has_adl_end_without_sprout<Container const&>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container const>::iterator
|
||||||
|
>::type
|
||||||
|
range_end_impl(Container const& cont) {
|
||||||
|
return sprout_container_range_detail::range_adl_end(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_end<Container const>::value
|
||||||
|
&& !sprout::detail::has_adl_end_without_sprout<Container const&>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container const>::iterator
|
||||||
|
>::type
|
||||||
|
range_end_impl(Container const& cont) {
|
||||||
|
return std::end(cont);
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
||||||
|
range_end(Container& cont) {
|
||||||
|
return sprout::detail::range_end_impl(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
||||||
|
range_end(Container const& cont) {
|
||||||
|
return sprout::detail::range_end_impl(cont);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_END_HPP
|
128
sprout/container/detail/range_front.hpp
Normal file
128
sprout/container/detail/range_front.hpp
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_FRONT_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_FRONT_HPP
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/type_traits/is_const_cast_convertible.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/container/detail/range_begin.hpp>
|
||||||
|
#include <sprout/utility/as_const.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl range_front(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_front_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().front())>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_front_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_front
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_front
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_front_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_substitutable_const_front
|
||||||
|
: public sprout::bool_constant<
|
||||||
|
sprout::is_const_cast_convertible<
|
||||||
|
typename sprout::container_traits<T const>::reference,
|
||||||
|
typename sprout::container_traits<T>::reference
|
||||||
|
>::value
|
||||||
|
&& (
|
||||||
|
sprout::detail::has_mem_front<T const>::value
|
||||||
|
|| sprout::detail::has_mem_begin<T const>::value
|
||||||
|
|| sprout::detail::has_adl_begin_without_sprout<T const&>::value
|
||||||
|
)
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::is_substitutable_const_front<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_front_impl(Container& cont) {
|
||||||
|
typedef typename sprout::container_traits<Container>::reference type;
|
||||||
|
return const_cast<type>(sprout::front(sprout::as_const(cont)));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_front<Container>::value
|
||||||
|
&& sprout::detail::has_mem_front<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_front_impl(Container& cont) {
|
||||||
|
return cont.front();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_front<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_front<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_front_impl(Container& cont) {
|
||||||
|
return *sprout::begin(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_front<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::reference
|
||||||
|
>::type
|
||||||
|
range_front_impl(Container const& cont) {
|
||||||
|
return cont.front();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_front<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::reference
|
||||||
|
>::type
|
||||||
|
range_front_impl(Container const& cont) {
|
||||||
|
return *sprout::begin(cont);
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::reference
|
||||||
|
range_front(Container& cont) {
|
||||||
|
return sprout::detail::range_front_impl(cont);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::reference
|
||||||
|
range_front(Container const& cont) {
|
||||||
|
return sprout::detail::range_front_impl(cont);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_FRONT_HPP
|
129
sprout/container/detail/range_index_of.hpp
Normal file
129
sprout/container/detail/range_index_of.hpp
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_INDEX_OF_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_INDEX_OF_HPP
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/container/detail/range_begin.hpp>
|
||||||
|
#include <sprout/iterator/operation.hpp>
|
||||||
|
#include <sprout/iterator/const_iterator_cast.hpp>
|
||||||
|
#include <sprout/utility/as_const.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl range_index_of(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_index_of_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().index_of(std::declval<typename sprout::container_traits<U>::iterator>()))>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_index_of_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_index_of
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_index_of
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_index_of_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_substitutable_const_index_of
|
||||||
|
: public sprout::bool_constant<
|
||||||
|
sprout::is_const_iterator_cast_convertible<
|
||||||
|
typename sprout::container_traits<T const>::iterator,
|
||||||
|
typename sprout::container_traits<T>::iterator
|
||||||
|
>::value
|
||||||
|
&& (
|
||||||
|
sprout::detail::has_mem_index_of<T const>::value
|
||||||
|
|| sprout::detail::has_mem_begin<T const>::value
|
||||||
|
|| sprout::detail::has_adl_begin_without_sprout<T const&>::value
|
||||||
|
)
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::is_substitutable_const_index_of<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::size_type
|
||||||
|
>::type
|
||||||
|
range_index_of_impl(Container& cont, typename sprout::container_traits<Container>::iterator p) {
|
||||||
|
typedef typename sprout::container_traits<Container>::iterator type;
|
||||||
|
return sprout::index_of(sprout::as_const(cont), sprout::const_iterator_cast<type>(p));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_index_of<Container>::value
|
||||||
|
&& sprout::detail::has_mem_index_of<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::size_type
|
||||||
|
>::type
|
||||||
|
range_index_of_impl(Container& cont, typename sprout::container_traits<Container>::iterator p) {
|
||||||
|
return cont.index_of(p);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_index_of<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_index_of<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::size_type
|
||||||
|
>::type
|
||||||
|
range_index_of_impl(Container& cont, typename sprout::container_traits<Container>::iterator p) {
|
||||||
|
return sprout::distance(sprout::begin(cont), p);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_index_of<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::size_type
|
||||||
|
>::type
|
||||||
|
range_index_of_impl(Container const& cont, typename sprout::container_traits<Container const>::iterator p) {
|
||||||
|
return cont.index_of(p);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_index_of<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::size_type
|
||||||
|
>::type
|
||||||
|
range_index_of_impl(Container const& cont, typename sprout::container_traits<Container const>::iterator p) {
|
||||||
|
return sprout::distance(sprout::begin(cont), p);
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::size_type
|
||||||
|
range_index_of(Container& cont, typename sprout::container_traits<Container>::iterator p) {
|
||||||
|
return sprout::detail::range_index_of_impl(cont, p);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::size_type
|
||||||
|
range_index_of(Container const& cont, typename sprout::container_traits<Container const>::iterator p) {
|
||||||
|
return sprout::detail::range_index_of_impl(cont, p);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_INDEX_OF_HPP
|
129
sprout/container/detail/range_nth.hpp
Normal file
129
sprout/container/detail/range_nth.hpp
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_NTH_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_NTH_HPP
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/container/detail/range_begin.hpp>
|
||||||
|
#include <sprout/iterator/operation.hpp>
|
||||||
|
#include <sprout/iterator/const_iterator_cast.hpp>
|
||||||
|
#include <sprout/utility/as_const.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl range_nth(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_nth_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().nth(std::declval<typename sprout::container_traits<U>::size_type>()))>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_nth_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_nth
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_nth
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_nth_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_substitutable_const_nth
|
||||||
|
: public sprout::bool_constant<
|
||||||
|
sprout::is_const_iterator_cast_convertible<
|
||||||
|
typename sprout::container_traits<T const>::iterator,
|
||||||
|
typename sprout::container_traits<T>::iterator
|
||||||
|
>::value
|
||||||
|
&& (
|
||||||
|
sprout::detail::has_mem_nth<T const>::value
|
||||||
|
|| sprout::detail::has_mem_begin<T const>::value
|
||||||
|
|| sprout::detail::has_adl_begin_without_sprout<T const&>::value
|
||||||
|
)
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::is_substitutable_const_nth<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_nth_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
typedef typename sprout::container_traits<Container>::iterator type;
|
||||||
|
return sprout::const_iterator_cast<type>(sprout::nth(sprout::as_const(cont), i));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_nth<Container>::value
|
||||||
|
&& sprout::detail::has_mem_nth<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_nth_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return cont.nth(i);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_nth<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_nth<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::iterator
|
||||||
|
>::type
|
||||||
|
range_nth_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return sprout::next(sprout::begin(cont), i);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_nth<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::iterator
|
||||||
|
>::type
|
||||||
|
range_nth_impl(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return cont.nth(i);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_nth<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::iterator
|
||||||
|
>::type
|
||||||
|
range_nth_impl(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return sprout::next(sprout::begin(cont), i);
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
||||||
|
range_nth(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return sprout::detail::range_nth_impl(cont, i);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
||||||
|
range_nth(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return sprout::detail::range_nth_impl(cont, i);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_NTH_HPP
|
77
sprout/container/detail/range_size.hpp
Normal file
77
sprout/container/detail/range_size.hpp
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_SIZE_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_SIZE_HPP
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/iterator/operation.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl range_size(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_size_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>().size())>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_size_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_size
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_size
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_size_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_size<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::size_type
|
||||||
|
>::type
|
||||||
|
range_size_impl(Container const& cont) {
|
||||||
|
return cont.size();
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_size<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::size_type
|
||||||
|
>::type
|
||||||
|
range_size_impl(Container const& cont) {
|
||||||
|
return sprout::distance(sprout::begin(cont), sprout::end(cont));
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::size_type
|
||||||
|
range_size(Container const& cont) {
|
||||||
|
return sprout::detail::range_size_impl(cont);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_SIZE_HPP
|
129
sprout/container/detail/range_subscript_at.hpp
Normal file
129
sprout/container/detail/range_subscript_at.hpp
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
/*=============================================================================
|
||||||
|
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_DETAIL_RANGE_SUBSCRIPT_AT_HPP
|
||||||
|
#define SPROUT_CONTAINER_DETAIL_RANGE_SUBSCRIPT_AT_HPP
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
#include <sprout/type_traits/is_const_cast_convertible.hpp>
|
||||||
|
#include <sprout/container/traits_fwd.hpp>
|
||||||
|
#include <sprout/container/container_traits.hpp>
|
||||||
|
#include <sprout/container/range_functions_fwd.hpp>
|
||||||
|
#include <sprout/container/detail/range_begin.hpp>
|
||||||
|
#include <sprout/iterator/operation.hpp>
|
||||||
|
#include <sprout/utility/as_const.hpp>
|
||||||
|
#include <sprout/adl/not_found.hpp>
|
||||||
|
|
||||||
|
namespace sprout_adl {
|
||||||
|
sprout::not_found_via_adl range_subscript_at(...);
|
||||||
|
} // namespace sprout_adl
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace detail {
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_subscript_test {
|
||||||
|
public:
|
||||||
|
template<
|
||||||
|
typename U = T,
|
||||||
|
typename = typename sprout::identity<decltype(std::declval<U>()[std::declval<typename sprout::container_traits<U>::size_type>()])>::type
|
||||||
|
>
|
||||||
|
static sprout::true_type test(int);
|
||||||
|
static sprout::false_type test(...);
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1900)
|
||||||
|
template<typename T, typename Base_ = typename sprout::identity<decltype(sprout::detail::has_mem_subscript_test<T>::test(0))>::type>
|
||||||
|
struct has_mem_subscript
|
||||||
|
: public Base_
|
||||||
|
{};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
struct has_mem_subscript
|
||||||
|
: public sprout::identity<decltype(sprout::detail::has_mem_subscript_test<T>::test(0))>::type
|
||||||
|
{};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_substitutable_const_subscript_at
|
||||||
|
: public sprout::bool_constant<
|
||||||
|
sprout::is_const_cast_convertible<
|
||||||
|
typename sprout::container_traits<T const>::reference,
|
||||||
|
typename sprout::container_traits<T>::reference
|
||||||
|
>::value
|
||||||
|
&& (
|
||||||
|
sprout::detail::has_mem_subscript<T const>::value
|
||||||
|
|| sprout::detail::has_mem_begin<T const>::value
|
||||||
|
|| sprout::detail::has_adl_begin_without_sprout<T const&>::value
|
||||||
|
)
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::is_substitutable_const_subscript_at<Container>::value,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_subscript_at_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
typedef typename sprout::container_traits<Container>::reference type;
|
||||||
|
return const_cast<type>(sprout::subscript_at(sprout::as_const(cont), i));
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_subscript_at<Container>::value
|
||||||
|
&& sprout::detail::has_mem_subscript<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_subscript_at_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return cont[i];
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::is_substitutable_const_subscript_at<Container>::value
|
||||||
|
&& !sprout::detail::has_mem_subscript<Container>::value
|
||||||
|
,
|
||||||
|
typename sprout::container_traits<Container>::reference
|
||||||
|
>::type
|
||||||
|
range_subscript_at_impl(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return *sprout::next(sprout::begin(cont), i);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
sprout::detail::has_mem_subscript<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::reference
|
||||||
|
>::type
|
||||||
|
range_subscript_at_impl(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return cont[i];
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||||
|
!sprout::detail::has_mem_subscript<Container const>::value,
|
||||||
|
typename sprout::container_traits<Container const>::reference
|
||||||
|
>::type
|
||||||
|
range_subscript_at_impl(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return *sprout::next(sprout::begin(cont), i);
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
namespace sprout_container_range_detail {
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::reference
|
||||||
|
range_subscript_at(Container& cont, typename sprout::container_traits<Container>::size_type i) {
|
||||||
|
return sprout::detail::range_subscript_at_impl(cont, i);
|
||||||
|
}
|
||||||
|
template<typename Container>
|
||||||
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::reference
|
||||||
|
range_subscript_at(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
|
return sprout::detail::range_subscript_at_impl(cont, i);
|
||||||
|
}
|
||||||
|
} // namespace sprout_container_range_detail
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_SUBSCRIPT_AT_HPP
|
|
@ -131,7 +131,4 @@ namespace sprout {
|
||||||
shrink_to_fit(Container&& cont);
|
shrink_to_fit(Container&& cont);
|
||||||
} // namespace sprout
|
} // namespace sprout
|
||||||
|
|
||||||
#include <sprout/container/size.hpp>
|
|
||||||
#include <sprout/container/empty.hpp>
|
|
||||||
|
|
||||||
#endif // #ifndef SPROUT_CONTAINER_RANGE_FUNCTIONS_FWD_HPP
|
#endif // #ifndef SPROUT_CONTAINER_RANGE_FUNCTIONS_FWD_HPP
|
||||||
|
|
|
@ -20,8 +20,8 @@ namespace sprout {
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::size_type
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::size_type
|
||||||
range_index_check(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
range_index_check(Container const& cont, typename sprout::container_traits<Container const>::size_type i) {
|
||||||
return i >= sprout::size(cont) ? throw std::out_of_range("range_index_check: index out of range")
|
return i < sprout::size(cont) ? i
|
||||||
: i
|
: throw std::out_of_range("range_index_check: index out of range")
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
} // namespace sprout
|
} // namespace sprout
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<typename T, std::size_t N>
|
template<typename T, std::size_t N>
|
||||||
struct container_traits<sscrisk::cel::array<T, N> >
|
struct container_traits<sscrisk::cel::array<T, N> >
|
||||||
: public sprout::detail::container_traits_default<sscrisk::cel::array<T, N> >
|
: public sprout::container_traits_default<sscrisk::cel::array<T, N> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef sprout::index_iterator<sscrisk::cel::array<T, N>&, true, sprout::detail::const_subscript<> > iterator;
|
typedef sprout::index_iterator<sscrisk::cel::array<T, N>&, true, sprout::detail::const_subscript<> > iterator;
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<typename T, std::size_t N>
|
template<typename T, std::size_t N>
|
||||||
struct container_traits<std::array<T, N> >
|
struct container_traits<std::array<T, N> >
|
||||||
: public sprout::detail::container_traits_default<std::array<T, N> >
|
: public sprout::container_traits_default<std::array<T, N> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef sprout::index_iterator<std::array<T, N>&, true, sprout::detail::const_subscript<> > iterator;
|
typedef sprout::index_iterator<std::array<T, N>&, true, sprout::detail::const_subscript<> > iterator;
|
||||||
|
@ -38,10 +38,8 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
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 sprout::container_range_traits_default<std::array<T, N> >
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
typedef sprout::detail::container_range_traits_default<std::array<T, N> > base_type;
|
|
||||||
public:
|
public:
|
||||||
// iterators:
|
// iterators:
|
||||||
static SPROUT_CONSTEXPR typename sprout::container_traits<std::array<T, N> >::iterator
|
static SPROUT_CONSTEXPR typename sprout::container_traits<std::array<T, N> >::iterator
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct container_range_traits<std::complex<T> >
|
struct container_range_traits<std::complex<T> >
|
||||||
: public sprout::detail::container_range_traits_default<std::complex<T> >
|
: public sprout::container_range_traits_default<std::complex<T> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static SPROUT_CONSTEXPR typename sprout::container_traits<std::complex<T> >::iterator
|
static SPROUT_CONSTEXPR typename sprout::container_traits<std::complex<T> >::iterator
|
||||||
|
|
|
@ -163,7 +163,7 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
struct container_traits<sprout::range::range_container<Iterator> >
|
struct container_traits<sprout::range::range_container<Iterator> >
|
||||||
: public sprout::detail::container_traits_default<sprout::range::range_container<Iterator> >
|
: public sprout::container_traits_default<sprout::range::range_container<Iterator> >
|
||||||
{};
|
{};
|
||||||
} // namespace sprout
|
} // namespace sprout
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct container_range_traits<sprout::rational<T> >
|
struct container_range_traits<sprout::rational<T> >
|
||||||
: public sprout::detail::container_range_traits_default<sprout::rational<T> >
|
: public sprout::container_range_traits_default<sprout::rational<T> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static SPROUT_CONSTEXPR typename sprout::container_traits<sprout::rational<T> >::iterator
|
static SPROUT_CONSTEXPR typename sprout::container_traits<sprout::rational<T> >::iterator
|
||||||
|
|
Loading…
Reference in a new issue