fixed_container_traits をデフォルトで const に対応

This commit is contained in:
bolero-MURAKAMI 2011-10-13 05:12:00 +09:00
parent 10c46d9b85
commit 7abc568a53
2 changed files with 21 additions and 21 deletions

View file

@ -36,26 +36,8 @@ namespace sprout {
{
public:
typedef sscrisk::cel::array<T, N> fixed_container_type;
typedef fixed_container_type internal_type;
typedef internal_type clone_type;
typedef sprout::index_iterator<fixed_container_type&> iterator;
typedef sprout::index_iterator<fixed_container_type const&> const_iterator;
public:
SPROUT_STATIC_CONSTEXPR typename sprout::detail::fixed_container_traits_base<fixed_container_type>::size_type fixed_size
= std::tuple_size<typename std::remove_const<internal_type>::type>::value
;
};
//
// fixed_container_traits
//
template<typename T, std::size_t N>
struct fixed_container_traits<sscrisk::cel::array<T, N> const>
: public sprout::detail::fixed_container_traits_base<sscrisk::cel::array<T, N> const>
{
public:
typedef sscrisk::cel::array<T, N> const fixed_container_type;
typedef typename std::remove_const<fixed_container_type>::type internal_type;
typedef internal_type clone_type;
typedef sscrisk::cel::array<T, N> internal_type;
typedef sscrisk::cel::array<T, N> clone_type;
typedef sprout::index_iterator<fixed_container_type&> iterator;
typedef sprout::index_iterator<fixed_container_type const&> const_iterator;
public:

View file

@ -48,7 +48,7 @@ namespace sprout {
typedef Container internal_type;
typedef Container clone_type;
public:
SPROUT_STATIC_CONSTEXPR typename sprout::detail::fixed_container_traits_base<Container>::size_type fixed_size
SPROUT_STATIC_CONSTEXPR typename sprout::detail::fixed_container_traits_base<fixed_container_type>::size_type fixed_size
= std::tuple_size<typename std::remove_const<internal_type>::type>::value
;
};
@ -63,6 +63,24 @@ namespace sprout {
public:
SPROUT_STATIC_CONSTEXPR typename sprout::detail::fixed_container_traits_base<T[N]>::size_type fixed_size = N;
};
template<typename Container>
struct fixed_container_traits<Container const>
: public sprout::fixed_container_traits<Container>
{
public:
typedef typename sprout::fixed_container_traits<Container>::const_iterator iterator;
typedef typename sprout::fixed_container_traits<Container>::const_reference reference;
typedef typename sprout::fixed_container_traits<Container>::const_pointer pointer;
};
template<typename T, std::size_t N>
struct fixed_container_traits<T const[N]>
: public sprout::fixed_container_traits<T[N]>
{
public:
typedef typename sprout::fixed_container_traits<T[N]>::const_iterator iterator;
typedef typename sprout::fixed_container_traits<T[N]>::const_reference reference;
typedef typename sprout::fixed_container_traits<T[N]>::const_pointer pointer;
};
//
// rebind_fixed_size