mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
[desuructive changes] container traits new interface [破壊的変更]
This commit is contained in:
parent
52a2178ac1
commit
ad60c8c530
356 changed files with 3183 additions and 3251 deletions
|
@ -7,8 +7,8 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
@ -23,48 +23,46 @@ namespace sprout {
|
|||
class sub_array_impl {
|
||||
protected:
|
||||
typedef Container container_type;
|
||||
typedef typename std::remove_reference<container_type>::type fixed_container_type;
|
||||
typedef typename std::remove_const<fixed_container_type>::type internal_type;
|
||||
typedef typename std::remove_reference<container_type>::type internal_type;
|
||||
protected:
|
||||
SPROUT_STATIC_CONSTEXPR bool is_reference = std::is_reference<container_type>::value;
|
||||
SPROUT_STATIC_CONSTEXPR bool is_const = std::is_const<fixed_container_type>::value;
|
||||
SPROUT_STATIC_CONSTEXPR bool is_const = std::is_const<internal_type>::value;
|
||||
protected:
|
||||
typedef typename sprout::fixed_container_traits<fixed_container_type>::value_type value_type;
|
||||
typedef typename sprout::container_traits<internal_type>::value_type value_type;
|
||||
typedef typename std::conditional<
|
||||
is_const,
|
||||
typename sprout::fixed_container_traits<fixed_container_type>::const_iterator,
|
||||
typename sprout::fixed_container_traits<fixed_container_type>::iterator
|
||||
typename sprout::container_traits<internal_type>::const_iterator,
|
||||
typename sprout::container_traits<internal_type>::iterator
|
||||
>::type iterator;
|
||||
typedef typename sprout::fixed_container_traits<fixed_container_type>::const_iterator const_iterator;
|
||||
typedef typename sprout::container_traits<internal_type>::const_iterator const_iterator;
|
||||
typedef typename std::conditional<
|
||||
is_const,
|
||||
typename sprout::fixed_container_traits<fixed_container_type>::const_reference,
|
||||
typename sprout::fixed_container_traits<fixed_container_type>::reference
|
||||
typename sprout::container_traits<internal_type>::const_reference,
|
||||
typename sprout::container_traits<internal_type>::reference
|
||||
>::type reference;
|
||||
typedef typename sprout::fixed_container_traits<fixed_container_type>::const_reference const_reference;
|
||||
typedef typename sprout::fixed_container_traits<fixed_container_type>::size_type size_type;
|
||||
typedef typename sprout::fixed_container_traits<fixed_container_type>::difference_type difference_type;
|
||||
typedef typename sprout::container_traits<internal_type>::const_reference const_reference;
|
||||
typedef typename sprout::container_traits<internal_type>::size_type size_type;
|
||||
typedef typename sprout::container_traits<internal_type>::difference_type difference_type;
|
||||
typedef typename std::conditional<
|
||||
is_const,
|
||||
typename sprout::fixed_container_traits<fixed_container_type>::const_pointer,
|
||||
typename sprout::fixed_container_traits<fixed_container_type>::pointer
|
||||
typename sprout::container_traits<internal_type>::const_pointer,
|
||||
typename sprout::container_traits<internal_type>::pointer
|
||||
>::type pointer;
|
||||
typedef typename sprout::fixed_container_traits<fixed_container_type>::const_pointer const_pointer;
|
||||
typedef typename sprout::container_traits<internal_type>::const_pointer const_pointer;
|
||||
protected:
|
||||
SPROUT_STATIC_CONSTEXPR size_type static_size = sprout::fixed_container_traits<fixed_container_type>::fixed_size;
|
||||
SPROUT_STATIC_CONSTEXPR size_type fixed_size = static_size;
|
||||
SPROUT_STATIC_CONSTEXPR size_type static_size = sprout::container_traits<internal_type>::static_size;
|
||||
protected:
|
||||
typedef typename std::conditional<
|
||||
is_reference,
|
||||
fixed_container_type*,
|
||||
typename std::remove_const<fixed_container_type>::type
|
||||
internal_type*,
|
||||
typename std::remove_const<internal_type>::type
|
||||
>::type holder_type;
|
||||
typedef typename std::conditional<
|
||||
is_reference,
|
||||
fixed_container_type&,
|
||||
fixed_container_type const&
|
||||
internal_type&,
|
||||
internal_type const&
|
||||
>::type param_type;
|
||||
typedef fixed_container_type const& const_param_type;
|
||||
typedef internal_type const& const_param_type;
|
||||
protected:
|
||||
typedef typename std::conditional<
|
||||
std::is_array<holder_type>::value,
|
||||
|
@ -194,9 +192,7 @@ namespace sprout {
|
|||
typedef sprout::detail::sub_array_impl<Container> impl_type;
|
||||
public:
|
||||
typedef typename impl_type::container_type container_type;
|
||||
typedef typename impl_type::fixed_container_type fixed_container_type;
|
||||
typedef typename impl_type::internal_type internal_type;
|
||||
typedef sub_array<typename sprout::fixed_container_traits<internal_type>::clone_type> clone_type;
|
||||
public:
|
||||
SPROUT_STATIC_CONSTEXPR bool is_reference = impl_type::is_reference;
|
||||
SPROUT_STATIC_CONSTEXPR bool is_const = impl_type::is_const;
|
||||
|
@ -212,7 +208,6 @@ namespace sprout {
|
|||
typedef typename impl_type::const_pointer const_pointer;
|
||||
public:
|
||||
SPROUT_STATIC_CONSTEXPR size_type static_size = impl_type::static_size;
|
||||
SPROUT_STATIC_CONSTEXPR size_type fixed_size = impl_type::fixed_size;
|
||||
public:
|
||||
typedef typename impl_type::holder_type holder_type;
|
||||
typedef typename impl_type::param_type param_type;
|
||||
|
@ -230,7 +225,7 @@ namespace sprout {
|
|||
: impl_type(
|
||||
array_tag(),
|
||||
arr,
|
||||
typename sprout::index_range<0, fixed_size>::type(),
|
||||
typename sprout::index_range<0, static_size>::type(),
|
||||
first,
|
||||
last
|
||||
)
|
||||
|
@ -239,7 +234,7 @@ namespace sprout {
|
|||
: impl_type(
|
||||
array_tag(),
|
||||
arr,
|
||||
typename sprout::index_range<0, fixed_size>::type(),
|
||||
typename sprout::index_range<0, static_size>::type(),
|
||||
first,
|
||||
last
|
||||
)
|
||||
|
@ -248,7 +243,7 @@ namespace sprout {
|
|||
: impl_type(
|
||||
array_tag(),
|
||||
impl_type::template to_param<Container>(other.array_),
|
||||
typename sprout::index_range<0, fixed_size>::type(),
|
||||
typename sprout::index_range<0, static_size>::type(),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(other.get_array()), first),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(other.get_array()), last)
|
||||
)
|
||||
|
@ -257,7 +252,7 @@ namespace sprout {
|
|||
: impl_type(
|
||||
array_tag(),
|
||||
impl_type::template to_param<Container>(other.array_),
|
||||
typename sprout::index_range<0, fixed_size>::type(),
|
||||
typename sprout::index_range<0, static_size>::type(),
|
||||
first + other.first_,
|
||||
last + other.first_
|
||||
)
|
||||
|
@ -367,13 +362,10 @@ namespace sprout {
|
|||
}
|
||||
}
|
||||
|
||||
param_type get_fixed() {
|
||||
param_type get_internal() {
|
||||
return impl_type::template to_param<Container>(array_);
|
||||
}
|
||||
SPROUT_CONSTEXPR const_param_type get_fixed() const {
|
||||
return impl_type::template to_const_param<Container>(array_);
|
||||
}
|
||||
SPROUT_CONSTEXPR const_param_type get_cfixed() const {
|
||||
SPROUT_CONSTEXPR const_param_type get_internal() const {
|
||||
return impl_type::template to_const_param<Container>(array_);
|
||||
}
|
||||
param_type get_array() {
|
||||
|
@ -385,8 +377,6 @@ namespace sprout {
|
|||
};
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR typename sprout::sub_array<Container>::size_type sprout::sub_array<Container>::static_size;
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR typename sprout::sub_array<Container>::size_type sprout::sub_array<Container>::fixed_size;
|
||||
|
||||
//
|
||||
// operator==
|
||||
|
@ -430,141 +420,103 @@ namespace sprout {
|
|||
}
|
||||
|
||||
//
|
||||
// fixed_container_traits
|
||||
// container_construct_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_container_traits<sprout::sub_array<Container> >
|
||||
: public sprout::detail::fixed_container_traits_base<sprout::sub_array<Container> >
|
||||
{
|
||||
public:
|
||||
typedef typename sprout::sub_array<Container>::fixed_container_type fixed_container_type;
|
||||
struct container_construct_traits<sprout::sub_array<Container> > {
|
||||
private:
|
||||
typedef typename sprout::sub_array<Container>::internal_type internal_type;
|
||||
typedef typename sprout::sub_array<Container>::clone_type clone_type;
|
||||
typedef typename sprout::container_construct_traits<internal_type>::copied_type internal_copied_type;
|
||||
public:
|
||||
SPROUT_STATIC_CONSTEXPR typename sprout::detail::fixed_container_traits_base<sprout::sub_array<Container> >::size_type fixed_size
|
||||
= std::tuple_size<typename std::remove_const<internal_type>::type>::value
|
||||
;
|
||||
typedef sprout::sub_array<internal_copied_type> copied_type;
|
||||
private:
|
||||
static SPROUT_CONSTEXPR copied_type make_impl(internal_copied_type const& internal_copied) {
|
||||
return copied_type(internal_copied, sprout::begin(internal_copied), sprout::end(internal_copied));
|
||||
}
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR copied_type remake_impl(
|
||||
Cont&& cont,
|
||||
typename sprout::container_traits<sprout::sub_array<Container> >::difference_type size,
|
||||
internal_copied_type const& internal_copied
|
||||
)
|
||||
{
|
||||
return copied_type(
|
||||
internal_copied,
|
||||
sprout::next(sprout::begin(internal_copied), sprout::internal_begin_offset(cont)),
|
||||
sprout::next(sprout::begin(internal_copied), sprout::internal_begin_offset(cont) + size)
|
||||
);
|
||||
}
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR copied_type deep_copy(Cont&& cont) {
|
||||
return copied_type(
|
||||
sprout::deep_copy(sprout::get_internal(cont)),
|
||||
sprout::internal_begin_offset(cont),
|
||||
sprout::internal_end_offset(cont)
|
||||
);
|
||||
}
|
||||
template<typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type make(Args&&... args) {
|
||||
return make_impl(
|
||||
sprout::make<internal_type>(sprout::forward<Args>(args)...)
|
||||
);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type remake(
|
||||
Cont&& cont,
|
||||
typename sprout::container_traits<sprout::sub_array<Container> >::difference_type size,
|
||||
Args&&... args
|
||||
)
|
||||
{
|
||||
return remake_impl(
|
||||
sprout::forward<Cont>(cont),
|
||||
size,
|
||||
sprout::make<internal_type>(sprout::forward<Args>(args)...)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// rebind_fixed_size
|
||||
// container_transform_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct rebind_fixed_size<sprout::sub_array<Container> > {
|
||||
struct container_transform_traits<sprout::sub_array<Container> > {
|
||||
public:
|
||||
template<typename sprout::fixed_container_traits<sprout::sub_array<Container> >::size_type S>
|
||||
struct apply {
|
||||
public:
|
||||
typedef sprout::sub_array<
|
||||
typename sprout::rebind_fixed_size<
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::internal_type
|
||||
>::template apply<S>::type
|
||||
> type;
|
||||
template<typename sprout::container_traits<sprout::sub_array<Container> >::size_type Size>
|
||||
struct rebind_size {
|
||||
public:
|
||||
typedef sprout::sub_array<
|
||||
typename sprout::container_transform_traits<
|
||||
typename std::remove_reference<Container>::type
|
||||
>::template rebind_size<Size>::type
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// get_fixed_functor
|
||||
// sub_container_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct get_fixed_functor<sprout::sub_array<Container> > {
|
||||
struct sub_container_traits<sprout::sub_array<Container> > {
|
||||
private:
|
||||
typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::fixed_container_type fixed_container_type;
|
||||
public:
|
||||
fixed_container_type& operator()(sprout::sub_array<Container>& cont) const {
|
||||
return cont.get_fixed();
|
||||
static typename sprout::sub_array<Container>::param_type
|
||||
call(sprout::sub_array<Container>& cont) {
|
||||
return cont.get_internal();
|
||||
}
|
||||
SPROUT_CONSTEXPR fixed_container_type const& operator()(sprout::sub_array<Container> const& cont) const {
|
||||
return cont.get_fixed();
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// clone_functor
|
||||
//
|
||||
template<typename Container>
|
||||
struct clone_functor<sprout::sub_array<Container> > {
|
||||
private:
|
||||
typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::clone_type clone_type;
|
||||
private:
|
||||
template<typename Other>
|
||||
SPROUT_CONSTEXPR clone_type make(
|
||||
Other&& cont,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type first,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type last
|
||||
) const
|
||||
{
|
||||
return clone_type(
|
||||
sprout::clone(sprout::get_fixed(sprout::forward<Other>(cont))),
|
||||
first,
|
||||
last
|
||||
);
|
||||
static SPROUT_CONSTEXPR typename sprout::sub_array<Container>::const_param_type
|
||||
call(sprout::sub_array<Container> const& cont) {
|
||||
return cont.get_internal();
|
||||
}
|
||||
public:
|
||||
template<typename Other>
|
||||
SPROUT_CONSTEXPR clone_type operator()(Other&& cont) const {
|
||||
return make(
|
||||
sprout::forward<Other>(cont),
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::fixed_end_offset(cont)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// make_clone_functor
|
||||
//
|
||||
template<typename Container>
|
||||
struct make_clone_functor<sprout::sub_array<Container> > {
|
||||
private:
|
||||
typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::clone_type clone_type;
|
||||
typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::internal_type internal_type;
|
||||
private:
|
||||
SPROUT_CONSTEXPR clone_type make(typename sprout::fixed_container_traits<internal_type>::clone_type const& arr) const {
|
||||
return clone_type(arr, sprout::begin(arr), sprout::end(arr));
|
||||
}
|
||||
template<typename Cont>
|
||||
struct internal {
|
||||
public:
|
||||
typedef decltype(call(std::declval<Cont&&>())) type;
|
||||
};
|
||||
public:
|
||||
template<typename... Args>
|
||||
SPROUT_CONSTEXPR clone_type operator()(Args&&... args) const {
|
||||
return make(sprout::make_clone<internal_type>(sprout::forward<Args>(args)...));
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// remake_clone_functor
|
||||
//
|
||||
template<typename Container>
|
||||
struct remake_clone_functor<sprout::sub_array<Container> > {
|
||||
private:
|
||||
typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::clone_type clone_type;
|
||||
typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::internal_type internal_type;
|
||||
private:
|
||||
template<typename Other>
|
||||
SPROUT_CONSTEXPR clone_type remake(
|
||||
Other&& other,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type size,
|
||||
typename sprout::fixed_container_traits<internal_type>::clone_type const& cloned
|
||||
) const
|
||||
{
|
||||
return clone_type(
|
||||
cloned,
|
||||
sprout::next(sprout::begin(cloned), sprout::fixed_begin_offset(other)),
|
||||
sprout::next(sprout::begin(cloned), sprout::fixed_begin_offset(other) + size)
|
||||
);
|
||||
}
|
||||
public:
|
||||
template<typename Other, typename... Args>
|
||||
SPROUT_CONSTEXPR clone_type operator()(
|
||||
Other&& other,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type size,
|
||||
Args&&... args
|
||||
) const
|
||||
{
|
||||
return remake(
|
||||
sprout::forward<Other>(other),
|
||||
size,
|
||||
sprout::make_clone<internal_type>(sprout::forward<Args>(args)...)
|
||||
);
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR typename internal<Cont>::type get_internal(Cont&& cont) {
|
||||
return call(sprout::forward<Cont>(cont));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -600,8 +552,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container&> >::type sub(
|
||||
Container& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container&> >::const_iterator first,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container&> >::const_iterator last
|
||||
typename sprout::container_traits<sprout::sub_array<Container&> >::const_iterator first,
|
||||
typename sprout::container_traits<sprout::sub_array<Container&> >::const_iterator last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<Container&>(arr, first, last);
|
||||
|
@ -609,8 +561,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container&> >::type sub(
|
||||
Container& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container&> >::difference_type first,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container&> >::difference_type last
|
||||
typename sprout::container_traits<sprout::sub_array<Container&> >::difference_type first,
|
||||
typename sprout::container_traits<sprout::sub_array<Container&> >::difference_type last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<Container&>(arr, first, last);
|
||||
|
@ -618,7 +570,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container&> >::type sub(
|
||||
Container& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container&> >::const_iterator first
|
||||
typename sprout::container_traits<sprout::sub_array<Container&> >::const_iterator first
|
||||
)
|
||||
{
|
||||
return sprout::sub(arr, first, sprout::end(arr));
|
||||
|
@ -626,7 +578,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container&> >::type sub(
|
||||
Container& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container&> >::difference_type first
|
||||
typename sprout::container_traits<sprout::sub_array<Container&> >::difference_type first
|
||||
)
|
||||
{
|
||||
return sprout::sub(arr, first, sprout::size(arr));
|
||||
|
@ -644,8 +596,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container const&> >::type sub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::const_iterator first,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::const_iterator last
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::const_iterator first,
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::const_iterator last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<Container const&>(arr, first, last);
|
||||
|
@ -653,8 +605,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container const&> >::type sub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::difference_type first,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::difference_type last
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::difference_type first,
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::difference_type last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<Container const&>(arr, first, last);
|
||||
|
@ -662,7 +614,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container const&> >::type sub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::const_iterator first
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::const_iterator first
|
||||
)
|
||||
{
|
||||
return sprout::sub(arr, first, sprout::end(arr));
|
||||
|
@ -670,7 +622,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container const&> >::type sub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::difference_type first
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::difference_type first
|
||||
)
|
||||
{
|
||||
return sprout::sub(arr, first, sprout::size(arr));
|
||||
|
@ -688,8 +640,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, Container>::type sub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator first,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator last
|
||||
typename sprout::container_traits<Container>::const_iterator first,
|
||||
typename sprout::container_traits<Container>::const_iterator last
|
||||
)
|
||||
{
|
||||
return Container(arr, first, last);
|
||||
|
@ -697,8 +649,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, Container>::type sub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type first,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type last
|
||||
typename sprout::container_traits<Container>::difference_type first,
|
||||
typename sprout::container_traits<Container>::difference_type last
|
||||
)
|
||||
{
|
||||
return Container(arr, first, last);
|
||||
|
@ -706,7 +658,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, Container>::type sub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator first
|
||||
typename sprout::container_traits<Container>::const_iterator first
|
||||
)
|
||||
{
|
||||
return sprout::sub(arr, first, sprout::end(arr));
|
||||
|
@ -714,7 +666,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, Container>::type sub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type first
|
||||
typename sprout::container_traits<Container>::difference_type first
|
||||
)
|
||||
{
|
||||
return sprout::sub(arr, first, sprout::size(arr));
|
||||
|
@ -733,8 +685,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container const&> >::type csub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::const_iterator first,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::const_iterator last
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::const_iterator first,
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::const_iterator last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<Container const&>(arr, first, last);
|
||||
|
@ -742,8 +694,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container const&> >::type csub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::difference_type first,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::difference_type last
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::difference_type first,
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::difference_type last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<Container const&>(arr, first, last);
|
||||
|
@ -751,7 +703,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container const&> >::type csub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::const_iterator first
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::const_iterator first
|
||||
)
|
||||
{
|
||||
return sprout::csub(arr, first, sprout::end(arr));
|
||||
|
@ -759,7 +711,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container const&> >::type csub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<sprout::sub_array<Container const&> >::difference_type first
|
||||
typename sprout::container_traits<sprout::sub_array<Container const&> >::difference_type first
|
||||
)
|
||||
{
|
||||
return sprout::csub(arr, first, sprout::size(arr));
|
||||
|
@ -775,45 +727,45 @@ namespace sprout {
|
|||
// csub
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type const&> >::type csub(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type const&> >::type csub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator first,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator last
|
||||
typename sprout::container_traits<Container>::const_iterator first,
|
||||
typename sprout::container_traits<Container>::const_iterator last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<typename Container::fixed_container_type const&>(arr.get_array(), first, last);
|
||||
return sprout::sub_array<typename Container::internal_type const&>(arr.get_array(), first, last);
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type const&> >::type csub(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type const&> >::type csub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type first,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type last
|
||||
typename sprout::container_traits<Container>::difference_type first,
|
||||
typename sprout::container_traits<Container>::difference_type last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<typename Container::fixed_container_type const&>(
|
||||
return sprout::sub_array<typename Container::internal_type const&>(
|
||||
arr.get_array(),
|
||||
sprout::next(sprout::begin(arr), first),
|
||||
sprout::next(sprout::begin(arr), last)
|
||||
);
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type const&> >::type csub(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type const&> >::type csub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator first
|
||||
typename sprout::container_traits<Container>::const_iterator first
|
||||
)
|
||||
{
|
||||
return sprout::csub(arr, first, sprout::end(arr));
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type const&> >::type csub(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type const&> >::type csub(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type first
|
||||
typename sprout::container_traits<Container>::difference_type first
|
||||
)
|
||||
{
|
||||
return sprout::csub(arr, first, sprout::size(arr));
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type const&> >::type csub(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type const&> >::type csub(
|
||||
Container const& arr
|
||||
)
|
||||
{
|
||||
|
@ -826,8 +778,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container> >::type sub_copy(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator first,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator last
|
||||
typename sprout::container_traits<Container>::const_iterator first,
|
||||
typename sprout::container_traits<Container>::const_iterator last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<Container>(arr, first, last);
|
||||
|
@ -835,8 +787,8 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container> >::type sub_copy(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type first,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type last
|
||||
typename sprout::container_traits<Container>::difference_type first,
|
||||
typename sprout::container_traits<Container>::difference_type last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<Container>(arr, first, last);
|
||||
|
@ -844,7 +796,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container> >::type sub_copy(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator first
|
||||
typename sprout::container_traits<Container>::const_iterator first
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(arr, first, sprout::end(arr));
|
||||
|
@ -852,7 +804,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container> >::type sub_copy(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type first
|
||||
typename sprout::container_traits<Container>::difference_type first
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(arr, first, sprout::size(arr));
|
||||
|
@ -868,45 +820,45 @@ namespace sprout {
|
|||
// sub_copy
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type> >::type sub_copy(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type> >::type sub_copy(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator first,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator last
|
||||
typename sprout::container_traits<Container>::const_iterator first,
|
||||
typename sprout::container_traits<Container>::const_iterator last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<typename Container::fixed_container_type>(arr.get_array(), first, last);
|
||||
return sprout::sub_array<typename Container::internal_type>(arr.get_array(), first, last);
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type> >::type sub_copy(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type> >::type sub_copy(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type first,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type last
|
||||
typename sprout::container_traits<Container>::difference_type first,
|
||||
typename sprout::container_traits<Container>::difference_type last
|
||||
)
|
||||
{
|
||||
return sprout::sub_array<typename Container::fixed_container_type>(
|
||||
return sprout::sub_array<typename Container::internal_type>(
|
||||
arr.get_array(),
|
||||
sprout::next(sprout::begin(arr), first),
|
||||
sprout::next(sprout::begin(arr), last)
|
||||
);
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type> >::type sub_copy(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type> >::type sub_copy(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator first
|
||||
typename sprout::container_traits<Container>::const_iterator first
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(arr, first, sprout::end(arr));
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type> >::type sub_copy(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type> >::type sub_copy(
|
||||
Container const& arr,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type first
|
||||
typename sprout::container_traits<Container>::difference_type first
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(arr, first, sprout::size(arr));
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::fixed_container_type> >::type sub_copy(
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<sprout::is_sub_array<Container>::value, sprout::sub_array<typename Container::internal_type> >::type sub_copy(
|
||||
Container const& arr
|
||||
)
|
||||
{
|
||||
|
@ -919,28 +871,17 @@ namespace std {
|
|||
// tuple_size
|
||||
//
|
||||
template<typename Container>
|
||||
struct tuple_size<sprout::sub_array<Container> > {
|
||||
public:
|
||||
SPROUT_STATIC_CONSTEXPR std::size_t value = std::tuple_size<
|
||||
typename std::remove_const<
|
||||
typename std::remove_reference<Container>::type
|
||||
>::type
|
||||
>::value;
|
||||
};
|
||||
struct tuple_size<sprout::sub_array<Container> >
|
||||
: public std::tuple_size<typename std::remove_reference<Container>::type>
|
||||
{};
|
||||
|
||||
//
|
||||
// tuple_element
|
||||
//
|
||||
template<std::size_t I, typename Container>
|
||||
struct tuple_element<I, sprout::sub_array<Container> > {
|
||||
public:
|
||||
typedef typename std::tuple_element<
|
||||
I,
|
||||
typename std::remove_const<
|
||||
typename std::remove_reference<Container>::type
|
||||
>::type
|
||||
>::type type;
|
||||
};
|
||||
struct tuple_element<I, sprout::sub_array<Container> >
|
||||
: public std::tuple_element<I, typename std::remove_reference<Container>::type>
|
||||
{};
|
||||
} // namespace std
|
||||
|
||||
#endif // #ifndef SPROUT_SUB_ARRAY_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue