From ace6acad6984bfcbc5f682acddd49b893cf7f718 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Mon, 14 Jan 2013 01:33:54 +0900 Subject: [PATCH] fix: sub_array - support STL container --- sprout/pit/pit.hpp | 18 ++++++++++-------- sprout/sub_array/sub_array.hpp | 12 ++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/sprout/pit/pit.hpp b/sprout/pit/pit.hpp index f3ade3a3..09b22693 100644 --- a/sprout/pit/pit.hpp +++ b/sprout/pit/pit.hpp @@ -19,21 +19,23 @@ namespace sprout { class pit : public sprout::container_traits_facade { + private: + typedef sprout::container_traits_facade::type> facade_type; public: typedef Container container_type; - typedef typename sprout::container_traits_facade::value_type value_type; - typedef typename sprout::container_traits_facade::reference reference; - typedef typename sprout::container_traits_facade::const_reference const_reference; + typedef typename facade_type::value_type value_type; + typedef typename facade_type::reference reference; + typedef typename facade_type::const_reference const_reference; typedef typename sprout::value_iterator iterator; typedef typename sprout::value_iterator const_iterator; - typedef typename sprout::container_traits_facade::size_type size_type; - typedef typename sprout::container_traits_facade::difference_type difference_type; - typedef typename sprout::container_traits_facade::pointer pointer; - typedef typename sprout::container_traits_facade::const_pointer const_pointer; + typedef typename facade_type::size_type size_type; + typedef typename facade_type::difference_type difference_type; + typedef typename facade_type::pointer pointer; + typedef typename facade_type::const_pointer const_pointer; typedef typename sprout::reverse_iterator reverse_iterator; typedef typename sprout::reverse_iterator const_reverse_iterator; public: - SPROUT_STATIC_CONSTEXPR size_type enumerable_size = sprout::detail::static_size_or_zero >::value; + SPROUT_STATIC_CONSTEXPR size_type enumerable_size = sprout::detail::static_size_or_zero::value; public: value_type elem; public: diff --git a/sprout/sub_array/sub_array.hpp b/sprout/sub_array/sub_array.hpp index 93c900db..01001c14 100644 --- a/sprout/sub_array/sub_array.hpp +++ b/sprout/sub_array/sub_array.hpp @@ -185,7 +185,7 @@ namespace sprout { typedef typename facade_type::pointer pointer; typedef typename facade_type::const_pointer const_pointer; public: - SPROUT_STATIC_CONSTEXPR size_type static_size = facade_type::static_size; + SPROUT_STATIC_CONSTEXPR size_type enumerable_size = sprout::detail::static_size_or_zero::value; public: typedef typename impl_type::holder_type holder_type; typedef typename impl_type::param_type param_type; @@ -203,7 +203,7 @@ namespace sprout { : impl_type( array_tag(), arr, - sprout::index_range<0, static_size>::make(), + sprout::index_range<0, enumerable_size>::make(), first, last ) @@ -212,7 +212,7 @@ namespace sprout { : impl_type( array_tag(), arr, - sprout::index_range<0, static_size>::make(), + sprout::index_range<0, enumerable_size>::make(), first, last ) @@ -221,7 +221,7 @@ namespace sprout { : impl_type( array_tag(), impl_type::template to_param(other.array_), - sprout::index_range<0, static_size>::make(), + sprout::index_range<0, enumerable_size>::make(), sprout::distance(sprout::begin(other.get_array()), first), sprout::distance(sprout::begin(other.get_array()), last) ) @@ -230,7 +230,7 @@ namespace sprout { : impl_type( array_tag(), impl_type::template to_param(other.array_), - sprout::index_range<0, static_size>::make(), + sprout::index_range<0, enumerable_size>::make(), first + other.first_, last + other.first_ ) @@ -355,7 +355,7 @@ namespace sprout { } }; template - SPROUT_CONSTEXPR_OR_CONST typename sprout::sub_array::size_type sprout::sub_array::static_size; + SPROUT_CONSTEXPR_OR_CONST typename sprout::sub_array::size_type sprout::sub_array::enumerable_size; // // swap