diff --git a/sprout/container/at.hpp b/sprout/container/at.hpp index 097ac0ba..951affcc 100644 --- a/sprout/container/at.hpp +++ b/sprout/container/at.hpp @@ -22,7 +22,7 @@ namespace sprout { // [default] // ADL callable range_at(cont, i) -> range_at(cont, i) // [default] - // Container is T[N] -> cont[i] + // Container is T[N] -> cont[sprout::range_index_check(cont, i)] // otherwise, Container is not const // && sprout::is_const_cast_convertible // && (callable sprout::as_const(cont).at(i) diff --git a/sprout/container/boost/array.hpp b/sprout/container/boost/array.hpp index 888ce22f..42a39765 100644 --- a/sprout/container/boost/array.hpp +++ b/sprout/container/boost/array.hpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -43,7 +42,7 @@ namespace sprout { // template struct container_traits > - : public sprout::detail::container_traits_default > + : public sprout::container_traits_default > { public: typedef sprout::index_iterator&, true, sprout::detail::elems_subscript<> > iterator; @@ -55,7 +54,7 @@ namespace sprout { // template struct container_range_traits > - : public sprout::detail::container_range_traits_default > + : public sprout::container_range_traits_default > { public: // iterators: diff --git a/sprout/container/container_construct_traits.hpp b/sprout/container/container_construct_traits.hpp index a5521d95..48e779e1 100644 --- a/sprout/container/container_construct_traits.hpp +++ b/sprout/container/container_construct_traits.hpp @@ -24,9 +24,6 @@ #include namespace sprout { - // - // container_construct_traits - // namespace detail { template inline SPROUT_CONSTEXPR typename std::enable_if< @@ -85,37 +82,35 @@ namespace sprout { ) ); } - - template - struct container_construct_traits_impl { - public: - typedef Container copied_type; - public: - template - static SPROUT_CONSTEXPR copied_type - deep_copy(Cont&& cont) { - return SPROUT_FORWARD(Cont, cont); - } - template - static SPROUT_CONSTEXPR copied_type - make(Args&&... args) { - return sprout::detail::default_make_container(SPROUT_FORWARD(Args, args)...); - } - template - static SPROUT_CONSTEXPR copied_type - remake(Cont&& cont, typename sprout::container_traits::difference_type size, Args&&... args) { - return sprout::detail::default_remake_container( - SPROUT_FORWARD(Cont, cont), size, - SPROUT_FORWARD(Args, args)... - ); - } - }; } // namespace detail + // + // container_construct_traits + // template - struct container_construct_traits - : public sprout::detail::container_construct_traits_impl - {}; + struct container_construct_traits { + public: + typedef Container copied_type; + public: + template + static SPROUT_CONSTEXPR copied_type + deep_copy(Cont&& cont) { + return SPROUT_FORWARD(Cont, cont); + } + template + static SPROUT_CONSTEXPR copied_type + make(Args&&... args) { + return sprout::detail::default_make_container(SPROUT_FORWARD(Args, args)...); + } + template + static SPROUT_CONSTEXPR copied_type + remake(Cont&& cont, typename sprout::container_traits::difference_type size, Args&&... args) { + return sprout::detail::default_remake_container( + SPROUT_FORWARD(Cont, cont), size, + SPROUT_FORWARD(Args, args)... + ); + } + }; template struct container_construct_traits : public sprout::container_construct_traits diff --git a/sprout/container/container_range_traits.hpp b/sprout/container/container_range_traits.hpp index 30d03366..3b867c6c 100644 --- a/sprout/container/container_range_traits.hpp +++ b/sprout/container/container_range_traits.hpp @@ -8,1245 +8,26 @@ #ifndef SPROUT_CONTAINER_CONTAINER_RANGE_TRAITS_HPP #define SPROUT_CONTAINER_CONTAINER_RANGE_TRAITS_HPP -#include -#include -#include -#include #include -#include -#include -#include -#include +#include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include - -namespace sprout_adl { - sprout::not_found_via_adl begin(...); - sprout::not_found_via_adl end(...); - - sprout::not_found_via_adl range_begin(...); - sprout::not_found_via_adl range_end(...); - sprout::not_found_via_adl range_size(...); - sprout::not_found_via_adl range_empty(...); - sprout::not_found_via_adl range_front(...); - sprout::not_found_via_adl range_back(...); - sprout::not_found_via_adl range_subscript_at(...); - sprout::not_found_via_adl range_at(...); - sprout::not_found_via_adl range_nth(...); - sprout::not_found_via_adl range_index_of(...); - sprout::not_found_via_adl range_data(...); -} // namespace sprout_adl - - -namespace sprout_container_range_detail { - using sprout_adl::begin; - using sprout_adl::end; - - template - struct has_adl_begin_test { - public: - template< - typename U = T, - typename R = typename sprout::identity()))>::type - > - static sprout::is_found_via_adl test(int); - static sprout::false_type test(...); - }; - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_adl_begin(Container& cont) { - return begin(cont); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_adl_begin(Container const& cont) { - return begin(cont); - } - - template - struct has_adl_end_test { - public: - template< - typename U = T, - typename R = typename sprout::identity()))>::type - > - static sprout::is_found_via_adl test(int); - static sprout::false_type test(...); - }; - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_adl_end(Container& cont) { - return end(cont); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::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::test(0))>::type> - struct has_adl_begin - : public Base_ - {}; -#else - template - struct has_adl_begin - : public sprout::identity::test(0))>::type - {}; -#endif - template::value> - struct has_adl_begin_without_sprout - : public sprout::false_type - {}; - template - struct has_adl_begin_without_sprout - : public sprout::detail::has_adl_begin - {}; - - template - struct has_mem_begin_test { - public: - template< - typename U = T, - typename = typename sprout::identity().begin())>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_begin - : public Base_ - {}; -#else - template - struct has_mem_begin - : public sprout::identity::test(0))>::type - {}; -#endif - - template - struct is_substitutable_const_begin - : public sprout::bool_constant< - sprout::is_const_iterator_cast_convertible< - typename sprout::container_traits::iterator, - typename sprout::container_traits::iterator - >::value - && ( - sprout::detail::has_mem_begin::value - || sprout::detail::has_adl_begin_without_sprout::value - ) - > - {}; - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::is_substitutable_const_begin::value, - typename sprout::container_traits::iterator - >::type - range_begin_impl(Container& cont) { - typedef typename sprout::container_traits::iterator type; - return sprout::const_iterator_cast(sprout::begin(sprout::as_const(cont))); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_begin::value - && sprout::detail::has_mem_begin::value - , - typename sprout::container_traits::iterator - >::type - range_begin_impl(Container& cont) { - return cont.begin(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_begin::value - && !sprout::detail::has_mem_begin::value - && sprout::detail::has_adl_begin_without_sprout::value - , - typename sprout::container_traits::iterator - >::type - range_begin_impl(Container& cont) { - return sprout_container_range_detail::range_adl_begin(cont); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_begin::value - && !sprout::detail::has_mem_begin::value - && !sprout::detail::has_adl_begin_without_sprout::value - , - typename sprout::container_traits::iterator - >::type - range_begin_impl(Container& cont) { - return std::begin(cont); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_mem_begin::value, - typename sprout::container_traits::iterator - >::type - range_begin_impl(Container const& cont) { - return cont.begin(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_begin::value - && sprout::detail::has_adl_begin_without_sprout::value - , - typename sprout::container_traits::iterator - >::type - range_begin_impl(Container const& cont) { - return sprout_container_range_detail::range_adl_begin(cont); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_begin::value - && !sprout::detail::has_adl_begin_without_sprout::value - , - typename sprout::container_traits::iterator - >::type - range_begin_impl(Container const& cont) { - return std::begin(cont); - } - -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_adl_end - : public Base_ - {}; -#else - template - struct has_adl_end - : public sprout::identity::test(0))>::type - {}; -#endif - template::value> - struct has_adl_end_without_sprout - : public sprout::false_type - {}; - template - struct has_adl_end_without_sprout - : public sprout::detail::has_adl_end - {}; - - template - struct has_mem_end_test { - public: - template< - typename U = T, - typename = typename sprout::identity().end())>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_end - : public Base_ - {}; -#else - template - struct has_mem_end - : public sprout::identity::test(0))>::type - {}; -#endif - - template - struct is_substitutable_const_end - : public sprout::bool_constant< - sprout::is_const_iterator_cast_convertible< - typename sprout::container_traits::iterator, - typename sprout::container_traits::iterator - >::value - && ( - sprout::detail::has_mem_end::value - || sprout::detail::has_adl_end_without_sprout::value - ) - > - {}; - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::is_substitutable_const_end::value, - typename sprout::container_traits::iterator - >::type - range_end_impl(Container& cont) { - typedef typename sprout::container_traits::iterator type; - return sprout::const_iterator_cast(sprout::end(sprout::as_const(cont))); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_end::value - && sprout::detail::has_adl_end_without_sprout::value - , - typename sprout::container_traits::iterator - >::type - range_end_impl(Container& cont) { - return sprout_container_range_detail::range_adl_end(cont); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_end::value - && !sprout::detail::has_adl_end_without_sprout::value - && sprout::detail::has_mem_end::value - , - typename sprout::container_traits::iterator - >::type - range_end_impl(Container& cont) { - return cont.end(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_end::value - && !sprout::detail::has_adl_end_without_sprout::value - && !sprout::detail::has_mem_end::value - , - typename sprout::container_traits::iterator - >::type - range_end_impl(Container& cont) { - return std::end(cont); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_adl_end_without_sprout::value, - typename sprout::container_traits::iterator - >::type - range_end_impl(Container const& cont) { - return sprout_container_range_detail::range_adl_end(cont); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_adl_end_without_sprout::value && sprout::detail::has_mem_end::value, - typename sprout::container_traits::iterator - >::type - range_end_impl(Container const& cont) { - return cont.end(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_adl_end_without_sprout::value && !sprout::detail::has_mem_end::value, - typename sprout::container_traits::iterator - >::type - range_end_impl(Container const& cont) { - return std::end(cont); - } - - template - struct has_mem_size_test { - public: - template< - typename U = T, - typename = typename sprout::identity().size())>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_size - : public Base_ - {}; -#else - template - struct has_mem_size - : public sprout::identity::test(0))>::type - {}; -#endif - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_mem_size::value, - typename sprout::container_traits::size_type - >::type - range_size_impl(Container const& cont) { - return cont.size(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_size::value, - typename sprout::container_traits::size_type - >::type - range_size_impl(Container const& cont) { - return sprout::distance(sprout::begin(cont), sprout::end(cont)); - } - - template - struct has_mem_empty_test { - public: - template< - typename U = T, - typename = typename sprout::identity().empty())>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_empty - : public Base_ - {}; -#else - template - struct has_mem_empty - : public sprout::identity::test(0))>::type - {}; -#endif - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_mem_empty::value, - bool - >::type - range_empty_impl(Container const& cont) { - return cont.empty(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_empty::value, - bool - >::type - range_empty_impl(Container const& cont) { - return sprout::size(cont) == 0; - } - - template - struct has_mem_front_test { - public: - template< - typename U = T, - typename = typename sprout::identity().front())>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_front - : public Base_ - {}; -#else - template - struct has_mem_front - : public sprout::identity::test(0))>::type - {}; -#endif - - template - struct is_substitutable_const_front - : public sprout::bool_constant< - sprout::is_const_cast_convertible< - typename sprout::container_traits::reference, - typename sprout::container_traits::reference - >::value - && ( - sprout::detail::has_mem_front::value - || sprout::detail::has_mem_begin::value - || sprout::detail::has_adl_begin_without_sprout::value - ) - > - {}; - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::is_substitutable_const_front::value, - typename sprout::container_traits::reference - >::type - range_front_impl(Container& cont) { - typedef typename sprout::container_traits::reference type; - return const_cast(sprout::front(sprout::as_const(cont))); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_front::value - && sprout::detail::has_mem_front::value - , - typename sprout::container_traits::reference - >::type - range_front_impl(Container& cont) { - return cont.front(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_front::value - && !sprout::detail::has_mem_front::value - , - typename sprout::container_traits::reference - >::type - range_front_impl(Container& cont) { - return *sprout::begin(cont); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_mem_front::value, - typename sprout::container_traits::reference - >::type - range_front_impl(Container const& cont) { - return cont.front(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_front::value, - typename sprout::container_traits::reference - >::type - range_front_impl(Container const& cont) { - return *sprout::begin(cont); - } - - template - struct has_mem_back_test { - public: - template< - typename U = T, - typename = typename sprout::identity().back())>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_back - : public Base_ - {}; -#else - template - struct has_mem_back - : public sprout::identity::test(0))>::type - {}; -#endif - - template - struct is_substitutable_const_back - : public sprout::bool_constant< - sprout::is_const_cast_convertible< - typename sprout::container_traits::reference, - typename sprout::container_traits::reference - >::value - && ( - sprout::detail::has_mem_back::value - || sprout::detail::has_mem_begin::value - || sprout::detail::has_adl_begin_without_sprout::value - ) - > - {}; - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::is_substitutable_const_back::value, - typename sprout::container_traits::reference - >::type - range_back_impl(Container& cont) { - typedef typename sprout::container_traits::reference type; - return const_cast(sprout::back(sprout::as_const(cont))); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_back::value - && sprout::detail::has_mem_back::value - , - typename sprout::container_traits::reference - >::type - range_back_impl(Container& cont) { - return cont.back(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_back::value - && !sprout::detail::has_mem_back::value - , - typename sprout::container_traits::reference - >::type - range_back_impl(Container& cont) { - return *sprout::begin(cont); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_mem_back::value, - typename sprout::container_traits::reference - >::type - range_back_impl(Container const& cont) { - return cont.back(); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_back::value, - typename sprout::container_traits::reference - >::type - range_back_impl(Container const& cont) { - return *sprout::next(sprout::begin(cont), sprout::size(cont) - 1); - } - - template - struct has_mem_subscript_test { - public: - template< - typename U = T, - typename = typename sprout::identity()[std::declval::size_type>()])>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_subscript - : public Base_ - {}; -#else - template - struct has_mem_subscript - : public sprout::identity::test(0))>::type - {}; -#endif - - template - struct is_substitutable_const_subscript_at - : public sprout::bool_constant< - sprout::is_const_cast_convertible< - typename sprout::container_traits::reference, - typename sprout::container_traits::reference - >::value - && ( - sprout::detail::has_mem_subscript::value - || sprout::detail::has_mem_begin::value - || sprout::detail::has_adl_begin_without_sprout::value - ) - > - {}; - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::is_substitutable_const_subscript_at::value, - typename sprout::container_traits::reference - >::type - range_subscript_at_impl(Container& cont, typename sprout::container_traits::size_type i) { - typedef typename sprout::container_traits::reference type; - return const_cast(sprout::subscript_at(sprout::as_const(cont), i)); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_subscript_at::value - && sprout::detail::has_mem_subscript::value - , - typename sprout::container_traits::reference - >::type - range_subscript_at_impl(Container& cont, typename sprout::container_traits::size_type i) { - return cont[i]; - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_subscript_at::value - && !sprout::detail::has_mem_subscript::value - , - typename sprout::container_traits::reference - >::type - range_subscript_at_impl(Container& cont, typename sprout::container_traits::size_type i) { - return *sprout::next(sprout::begin(cont), i); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_mem_subscript::value, - typename sprout::container_traits::reference - >::type - range_subscript_at_impl(Container const& cont, typename sprout::container_traits::size_type i) { - return cont[i]; - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_subscript::value, - typename sprout::container_traits::reference - >::type - range_subscript_at_impl(Container const& cont, typename sprout::container_traits::size_type i) { - return *sprout::next(sprout::begin(cont), i); - } - - template - struct has_mem_at_test { - public: - template< - typename U = T, - typename = typename sprout::identity().at(std::declval::size_type>()))>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_at - : public Base_ - {}; -#else - template - struct has_mem_at - : public sprout::identity::test(0))>::type - {}; -#endif - - template - struct is_substitutable_const_at - : public sprout::bool_constant< - sprout::is_const_cast_convertible< - typename sprout::container_traits::reference, - typename sprout::container_traits::reference - >::value - && ( - sprout::detail::has_mem_at::value - || sprout::detail::has_mem_subscript::value - || sprout::detail::has_mem_begin::value - || sprout::detail::has_adl_begin_without_sprout::value - ) - > - {}; - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::is_substitutable_const_at::value, - typename sprout::container_traits::reference - >::type - range_at_impl(Container& cont, typename sprout::container_traits::size_type i) { - typedef typename sprout::container_traits::reference type; - return const_cast(sprout::at(sprout::as_const(cont), i)); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_at::value - && sprout::detail::has_mem_at::value - , - typename sprout::container_traits::reference - >::type - range_at_impl(Container& cont, typename sprout::container_traits::size_type i) { - return cont.at(i); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_at::value - && !sprout::detail::has_mem_at::value - && sprout::detail::has_mem_subscript::value - , - typename sprout::container_traits::reference - >::type - range_at_impl(Container& cont, typename sprout::container_traits::size_type i) { - return cont[sprout::range_index_check(cont, i)]; - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_at::value - && !sprout::detail::has_mem_at::value - && !sprout::detail::has_mem_subscript::value - , - typename sprout::container_traits::reference - >::type - range_at_impl(Container& cont, typename sprout::container_traits::size_type i) { - return *sprout::next(sprout::begin(cont), sprout::range_index_check(cont, i)); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_mem_at::value, - typename sprout::container_traits::reference - >::type - range_at_impl(Container const& cont, typename sprout::container_traits::size_type i) { - return cont.at(i); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_at::value - && sprout::detail::has_mem_subscript::value - , - typename sprout::container_traits::reference - >::type - range_at_impl(Container const& cont, typename sprout::container_traits::size_type i) { - return cont[sprout::range_index_check(cont, i)]; - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_at::value - && !sprout::detail::has_mem_subscript::value - , - typename sprout::container_traits::reference - >::type - range_at_impl(Container const& cont, typename sprout::container_traits::size_type i) { - return *sprout::next(sprout::begin(cont), sprout::range_index_check(cont, i)); - } - - template - struct has_mem_nth_test { - public: - template< - typename U = T, - typename = typename sprout::identity().nth(std::declval::size_type>()))>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_nth - : public Base_ - {}; -#else - template - struct has_mem_nth - : public sprout::identity::test(0))>::type - {}; -#endif - - template - struct is_substitutable_const_nth - : public sprout::bool_constant< - sprout::is_const_iterator_cast_convertible< - typename sprout::container_traits::iterator, - typename sprout::container_traits::iterator - >::value - && ( - sprout::detail::has_mem_nth::value - || sprout::detail::has_mem_begin::value - || sprout::detail::has_adl_begin_without_sprout::value - ) - > - {}; - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::is_substitutable_const_nth::value, - typename sprout::container_traits::iterator - >::type - range_nth_impl(Container& cont, typename sprout::container_traits::size_type i) { - typedef typename sprout::container_traits::iterator type; - return sprout::const_iterator_cast(sprout::nth(sprout::as_const(cont), i)); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_nth::value - && sprout::detail::has_mem_nth::value - , - typename sprout::container_traits::iterator - >::type - range_nth_impl(Container& cont, typename sprout::container_traits::size_type i) { - return cont.nth(i); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_nth::value - && !sprout::detail::has_mem_nth::value - , - typename sprout::container_traits::iterator - >::type - range_nth_impl(Container& cont, typename sprout::container_traits::size_type i) { - return sprout::next(sprout::begin(cont), i); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_mem_nth::value, - typename sprout::container_traits::iterator - >::type - range_nth_impl(Container const& cont, typename sprout::container_traits::size_type i) { - return cont.nth(i); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_nth::value, - typename sprout::container_traits::iterator - >::type - range_nth_impl(Container const& cont, typename sprout::container_traits::size_type i) { - return sprout::next(sprout::begin(cont), i); - } - - template - struct has_mem_index_of_test { - public: - template< - typename U = T, - typename = typename sprout::identity().index_of(std::declval::iterator>()))>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_index_of - : public Base_ - {}; -#else - template - struct has_mem_index_of - : public sprout::identity::test(0))>::type - {}; -#endif - - template - struct is_substitutable_const_index_of - : public sprout::bool_constant< - sprout::is_const_iterator_cast_convertible< - typename sprout::container_traits::iterator, - typename sprout::container_traits::iterator - >::value - && ( - sprout::detail::has_mem_index_of::value - || sprout::detail::has_mem_begin::value - || sprout::detail::has_adl_begin_without_sprout::value - ) - > - {}; - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::is_substitutable_const_index_of::value, - typename sprout::container_traits::size_type - >::type - range_index_of_impl(Container& cont, typename sprout::container_traits::iterator p) { - typedef typename sprout::container_traits::iterator type; - return sprout::index_of(sprout::as_const(cont), sprout::const_iterator_cast(p)); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_index_of::value - && sprout::detail::has_mem_index_of::value - , - typename sprout::container_traits::size_type - >::type - range_index_of_impl(Container& cont, typename sprout::container_traits::iterator p) { - return cont.index_of(p); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_index_of::value - && !sprout::detail::has_mem_index_of::value - , - typename sprout::container_traits::size_type - >::type - range_index_of_impl(Container& cont, typename sprout::container_traits::iterator p) { - return sprout::distance(sprout::begin(cont), p); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::has_mem_index_of::value, - typename sprout::container_traits::size_type - >::type - range_index_of_impl(Container const& cont, typename sprout::container_traits::iterator p) { - return cont.index_of(p); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::has_mem_index_of::value, - typename sprout::container_traits::size_type - >::type - range_index_of_impl(Container const& cont, typename sprout::container_traits::iterator p) { - return sprout::distance(sprout::begin(cont), p); - } - - template - struct has_mem_data_test { - public: - template< - typename U = T, - typename = typename sprout::identity().data())>::type - > - static sprout::true_type test(int); - static sprout::false_type test(...); - }; -#if defined(_MSC_VER) && (_MSC_VER > 1900) - template::test(0))>::type> - struct has_mem_data - : public Base_ - {}; -#else - template - struct has_mem_data - : public sprout::identity::test(0))>::type - {}; -#endif - - template - struct is_substitutable_const_data - : public sprout::bool_constant< - sprout::is_const_cast_convertible< - typename sprout::container_traits::pointer, - typename sprout::container_traits::pointer - >::value - && sprout::detail::has_mem_data::value - > - {}; - - template - inline SPROUT_CONSTEXPR typename std::enable_if< - sprout::detail::is_substitutable_const_data::value, - typename sprout::container_traits::pointer - >::type - range_data_impl(Container& cont) { - typedef typename sprout::container_traits::pointer type; - return const_cast(sprout::data(sprout::as_const(cont))); - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - !sprout::detail::is_substitutable_const_data::value, - typename sprout::container_traits::pointer - >::type - range_data_impl(Container& cont) { - return cont.data(); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer - range_data_impl(Container const& cont) { - return cont.data(); - } - } // namespace detail -} // namespace sprout - -namespace sprout_container_range_detail { - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_begin(Container& cont) { - return sprout::detail::range_begin_impl(cont); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_begin(Container const& cont) { - return sprout::detail::range_begin_impl(cont); - } - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_end(Container& cont) { - return sprout::detail::range_end_impl(cont); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_end(Container const& cont) { - return sprout::detail::range_end_impl(cont); - } - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::size_type - range_size(Container const& cont) { - return sprout::detail::range_size_impl(cont); - } - - template - inline SPROUT_CONSTEXPR bool - range_empty(Container const& cont) { - return sprout::detail::range_empty_impl(cont); - } - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_front(Container& cont) { - return sprout::detail::range_front_impl(cont); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_front(Container const& cont) { - return sprout::detail::range_front_impl(cont); - } - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_back(Container& cont) { - return sprout::detail::range_back_impl(cont); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_back(Container const& cont) { - return sprout::detail::range_back_impl(cont); - } - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_subscript_at(Container& cont, typename sprout::container_traits::size_type i) { - return sprout::detail::range_subscript_at_impl(cont, i); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_subscript_at(Container const& cont, typename sprout::container_traits::size_type i) { - return sprout::detail::range_subscript_at_impl(cont, i); - } - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_at(Container& cont, typename sprout::container_traits::size_type i) { - return sprout::detail::range_at_impl(cont, i); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_at(Container const& cont, typename sprout::container_traits::size_type i) { - return sprout::detail::range_at_impl(cont, i); - } - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_nth(Container& cont, typename sprout::container_traits::size_type i) { - return sprout::detail::range_nth_impl(cont, i); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_nth(Container const& cont, typename sprout::container_traits::size_type i) { - return sprout::detail::range_nth_impl(cont, i); - } - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::size_type - range_index_of(Container& cont, typename sprout::container_traits::iterator p) { - return sprout::detail::range_index_of_impl(cont, p); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::size_type - range_index_of(Container const& cont, typename sprout::container_traits::iterator p) { - return sprout::detail::range_index_of_impl(cont, p); - } - - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer - range_data(Container& cont) { - return sprout::detail::range_data_impl(cont); - } - template - inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer - range_data(Container const& cont) { - return sprout::detail::range_data_impl(cont); - } -} // namespace sprout_container_range_detail - -namespace sprout { - namespace detail { - // - // container_range_traits_default - // - template - struct container_range_traits_default { - public: - // iterators: - static SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_begin(Container& cont) { - using sprout_container_range_detail::range_begin; - using sprout_adl::range_begin; - return range_begin(cont); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_begin(Container const& cont) { - using sprout_container_range_detail::range_begin; - using sprout_adl::range_begin; - return range_begin(cont); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_end(Container& cont) { - using sprout_container_range_detail::range_end; - using sprout_adl::range_end; - return range_end(cont); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_end(Container const& cont) { - using sprout_container_range_detail::range_end; - using sprout_adl::range_end; - return range_end(cont); - } - // capacity: - static SPROUT_CONSTEXPR typename sprout::container_traits::size_type - range_size(Container const& cont) { - using sprout_container_range_detail::range_size; - using sprout_adl::range_size; - return range_size(cont); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::size_type - range_empty(Container const& cont) { - using sprout_container_range_detail::range_empty; - using sprout_adl::range_empty; - return range_empty(cont); - } - // element access: - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_front(Container& cont) { - using sprout_container_range_detail::range_front; - using sprout_adl::range_front; - return range_front(cont); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_front(Container const& cont) { - using sprout_container_range_detail::range_front; - using sprout_adl::range_front; - return range_front(cont); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_back(Container& cont) { - using sprout_container_range_detail::range_back; - using sprout_adl::range_back; - return range_back(cont); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_back(Container const& cont) { - using sprout_container_range_detail::range_back; - using sprout_adl::range_back; - return range_back(cont); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_subscript_at(Container& cont, typename sprout::container_traits::size_type i) { - using sprout_container_range_detail::range_subscript_at; - using sprout_adl::range_subscript_at; - return range_subscript_at(cont, i); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_subscript_at(Container const& cont, typename sprout::container_traits::size_type i) { - using sprout_container_range_detail::range_subscript_at; - using sprout_adl::range_subscript_at; - return range_subscript_at(cont, i); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_at(Container& cont, typename sprout::container_traits::size_type i) { - using sprout_container_range_detail::range_at; - using sprout_adl::range_at; - return range_at(cont, i); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_at(Container const& cont, typename sprout::container_traits::size_type i) { - using sprout_container_range_detail::range_at; - using sprout_adl::range_at; - return range_at(cont, i); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_nth(Container& cont, typename sprout::container_traits::size_type i) { - using sprout_container_range_detail::range_nth; - using sprout_adl::range_nth; - return range_nth(cont, i); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_nth(Container const& cont, typename sprout::container_traits::size_type i) { - using sprout_container_range_detail::range_nth; - using sprout_adl::range_nth; - return range_nth(cont, i); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::size_type - range_index_of(Container& cont, typename sprout::container_traits::iterator p) { - using sprout_container_range_detail::range_index_of; - using sprout_adl::range_index_of; - return range_index_of(cont, p); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::size_type - range_index_of(Container const& cont, typename sprout::container_traits::iterator p) { - using sprout_container_range_detail::range_index_of; - using sprout_adl::range_index_of; - return range_index_of(cont, p); - } - // data access: - static SPROUT_CONSTEXPR typename sprout::container_traits::pointer - range_data(Container& cont) { - using sprout_container_range_detail::range_data; - using sprout_adl::range_data; - return range_data(cont); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::pointer - range_data(Container const& cont) { - using sprout_container_range_detail::range_data; - using sprout_adl::range_data; - return range_data(cont); - } - }; // // container_range_traits_const_default // @@ -1304,12 +85,227 @@ namespace sprout { }; } // namespace detail + // + // container_range_begin_default + // + template + struct container_range_begin_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_begin(Container& cont) { + using sprout_container_range_detail::range_begin; + using sprout_adl::range_begin; + return range_begin(cont); + } + static SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_begin(Container const& cont) { + using sprout_container_range_detail::range_begin; + using sprout_adl::range_begin; + return range_begin(cont); + } + }; + // + // container_range_end_default + // + template + struct container_range_end_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_end(Container& cont) { + using sprout_container_range_detail::range_end; + using sprout_adl::range_end; + return range_end(cont); + } + static SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_end(Container const& cont) { + using sprout_container_range_detail::range_end; + using sprout_adl::range_end; + return range_end(cont); + } + }; + // + // container_range_size_default + // + template + struct container_range_size_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::size_type + range_size(Container const& cont) { + using sprout_container_range_detail::range_size; + using sprout_adl::range_size; + return range_size(cont); + } + }; + // + // container_range_empty_default + // + template + struct container_range_empty_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::size_type + range_empty(Container const& cont) { + using sprout_container_range_detail::range_empty; + using sprout_adl::range_empty; + return range_empty(cont); + } + }; + // + // container_range_front_default + // + template + struct container_range_front_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_front(Container& cont) { + using sprout_container_range_detail::range_front; + using sprout_adl::range_front; + return range_front(cont); + } + static SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_front(Container const& cont) { + using sprout_container_range_detail::range_front; + using sprout_adl::range_front; + return range_front(cont); + } + }; + // + // container_range_back_default + // + template + struct container_range_back_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_back(Container& cont) { + using sprout_container_range_detail::range_back; + using sprout_adl::range_back; + return range_back(cont); + } + static SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_back(Container const& cont) { + using sprout_container_range_detail::range_back; + using sprout_adl::range_back; + return range_back(cont); + } + }; + // + // container_range_subscript_at_default + // + template + struct container_range_subscript_at_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_subscript_at(Container& cont, typename sprout::container_traits::size_type i) { + using sprout_container_range_detail::range_subscript_at; + using sprout_adl::range_subscript_at; + return range_subscript_at(cont, i); + } + static SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_subscript_at(Container const& cont, typename sprout::container_traits::size_type i) { + using sprout_container_range_detail::range_subscript_at; + using sprout_adl::range_subscript_at; + return range_subscript_at(cont, i); + } + }; + // + // container_range_at_default + // + template + struct container_range_at_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_at(Container& cont, typename sprout::container_traits::size_type i) { + using sprout_container_range_detail::range_at; + using sprout_adl::range_at; + return range_at(cont, i); + } + static SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_at(Container const& cont, typename sprout::container_traits::size_type i) { + using sprout_container_range_detail::range_at; + using sprout_adl::range_at; + return range_at(cont, i); + } + }; + // + // container_range_nth_default + // + template + struct container_range_nth_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_nth(Container& cont, typename sprout::container_traits::size_type i) { + using sprout_container_range_detail::range_nth; + using sprout_adl::range_nth; + return range_nth(cont, i); + } + static SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_nth(Container const& cont, typename sprout::container_traits::size_type i) { + using sprout_container_range_detail::range_nth; + using sprout_adl::range_nth; + return range_nth(cont, i); + } + }; + // + // container_range_index_of_default + // + template + struct container_range_index_of_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::size_type + range_index_of(Container& cont, typename sprout::container_traits::iterator p) { + using sprout_container_range_detail::range_index_of; + using sprout_adl::range_index_of; + return range_index_of(cont, p); + } + static SPROUT_CONSTEXPR typename sprout::container_traits::size_type + range_index_of(Container const& cont, typename sprout::container_traits::iterator p) { + using sprout_container_range_detail::range_index_of; + using sprout_adl::range_index_of; + return range_index_of(cont, p); + } + }; + // + // container_range_data_default + // + template + struct container_range_data_default { + public: + static SPROUT_CONSTEXPR typename sprout::container_traits::pointer + range_data(Container& cont) { + using sprout_container_range_detail::range_data; + using sprout_adl::range_data; + return range_data(cont); + } + static SPROUT_CONSTEXPR typename sprout::container_traits::pointer + range_data(Container const& cont) { + using sprout_container_range_detail::range_data; + using sprout_adl::range_data; + return range_data(cont); + } + }; + + // + // container_range_traits_default + // + template + struct container_range_traits_default + : public sprout::container_range_begin_default + , public sprout::container_range_end_default + , public sprout::container_range_size_default + , public sprout::container_range_front_default + , public sprout::container_range_back_default + , public sprout::container_range_subscript_at_default + , public sprout::container_range_at_default + , public sprout::container_range_nth_default + , public sprout::container_range_index_of_default + , public sprout::container_range_data_default + {}; + // // container_range_traits // template struct container_range_traits - : public sprout::detail::container_range_traits_default + : public sprout::container_range_traits_default {}; template struct container_range_traits @@ -1376,11 +372,11 @@ namespace sprout { } static SPROUT_CONSTEXPR typename sprout::container_traits::reference range_at(T (& arr)[N], typename sprout::container_traits::size_type i) { - return arr[i]; + return arr[sprout::range_index_check(arr, i)]; } static SPROUT_CONSTEXPR typename sprout::container_traits::reference range_at(T const (& arr)[N], typename sprout::container_traits::size_type i) { - return arr[i]; + return arr[sprout::range_index_check(arr, i)]; } static SPROUT_CONSTEXPR typename sprout::container_traits::iterator range_nth(T (& arr)[N], typename sprout::container_traits::size_type i) { @@ -1415,57 +411,9 @@ namespace sprout { } }; template - struct container_range_traits { - public: - // iterators: - static SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_begin(T const (& arr)[N]) { - return sprout::container_range_traits::range_begin(arr); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_end(T const (& arr)[N]) { - return sprout::container_range_traits::range_end(arr); - } - // capacity: - static SPROUT_CONSTEXPR typename sprout::container_traits::size_type - range_size(T const (& arr)[N]) { - return sprout::container_range_traits::range_size(arr); - } - static SPROUT_CONSTEXPR bool - range_empty(T const (& arr)[N]) { - return sprout::container_range_traits::range_empty(arr); - } - // element access: - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_front(T const (& arr)[N]) { - return sprout::container_range_traits::range_front(arr); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_back(T const (& arr)[N]) { - return sprout::container_range_traits::range_back(arr); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_subscript_at(T const (& arr)[N], typename sprout::container_traits::size_type i) { - return sprout::container_range_traits::range_subscript_at(arr, i); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::reference - range_at(T const (& arr)[N], typename sprout::container_traits::size_type i) { - return sprout::container_range_traits::range_at(arr, i); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::iterator - range_nth(T const (& arr)[N], typename sprout::container_traits::size_type i) { - return sprout::container_range_traits::range_nth(arr, i); - } - static SPROUT_CONSTEXPR typename sprout::container_traits::size_type - range_index_of(T const (& arr)[N], typename sprout::container_traits::iterator p) { - return sprout::container_range_traits::range_index_of(arr, p); - } - // data access: - static SPROUT_CONSTEXPR typename sprout::container_traits::pointer - range_data(T const (& arr)[N]) { - return sprout::container_range_traits::range_data(arr); - } - }; + struct container_range_traits + : public sprout::detail::container_range_traits_const_default + {}; } // namespace sprout #include diff --git a/sprout/container/container_traits.hpp b/sprout/container/container_traits.hpp index c609faea..a5c2ce18 100644 --- a/sprout/container/container_traits.hpp +++ b/sprout/container/container_traits.hpp @@ -392,7 +392,6 @@ namespace sprout { sprout::detail::is_array_like::value > {}; - // // container_nosy_fixed_size // @@ -414,52 +413,6 @@ namespace sprout { > {}; - // - // container_traits_default - // - template - struct container_traits_default - : public sprout::detail::container_nosy_value_type - , public sprout::detail::container_nosy_iterator - , public sprout::detail::container_nosy_const_iterator - , public sprout::detail::container_nosy_reference - , public sprout::detail::container_nosy_const_reference - , public sprout::detail::container_nosy_size_type - , public sprout::detail::container_nosy_difference_type - , public sprout::detail::container_nosy_pointer - , public sprout::detail::container_nosy_const_pointer - , public sprout::detail::container_nosy_static_size - , public sprout::detail::container_nosy_fixed_size - {}; - template - struct container_traits_default { - public: - typedef T value_type; -#if SPROUT_USE_PTR_INDEX_ITERATOR_IMPLEMENTATION - typedef sprout::ptr_index_iterator iterator; - typedef sprout::ptr_index_iterator 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 - SPROUT_CONSTEXPR_OR_CONST typename sprout::detail::container_traits_default::size_type - sprout::detail::container_traits_default::static_size; - // // container_traits_const_default // @@ -479,12 +432,87 @@ namespace sprout { {}; } // 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 + struct container_value_type_default + : public sprout::detail::container_nosy_value_type + {}; + template + struct container_iterator_default + : public sprout::detail::container_nosy_iterator + {}; + template + struct container_const_iterator_default + : public sprout::detail::container_nosy_const_iterator + {}; + template + struct container_reference_default + : public sprout::detail::container_nosy_reference + {}; + template + struct container_const_reference_default + : public sprout::detail::container_nosy_const_reference + {}; + template + struct container_size_type_default + : public sprout::detail::container_nosy_size_type + {}; + template + struct container_difference_type_default + : public sprout::detail::container_nosy_difference_type + {}; + template + struct container_pointer_default + : public sprout::detail::container_nosy_pointer + {}; + template + struct container_const_pointer_default + : public sprout::detail::container_nosy_const_pointer + {}; + template + struct container_static_size_default + : public sprout::detail::container_nosy_static_size + {}; + template + struct container_fixed_size_default + : public sprout::detail::container_nosy_fixed_size + {}; + // + // container_traits_default + // + template + struct container_traits_default + : public sprout::container_value_type_default + , public sprout::container_iterator_default + , public sprout::container_const_iterator_default + , public sprout::container_reference_default + , public sprout::container_const_reference_default + , public sprout::container_size_type_default + , public sprout::container_difference_type_default + , public sprout::container_pointer_default + , public sprout::container_const_pointer_default + , public sprout::container_static_size_default + , public sprout::container_fixed_size_default + {}; + // // container_traits // template struct container_traits - : public sprout::detail::container_traits_default + : public sprout::container_traits_default {}; template struct container_traits @@ -492,9 +520,33 @@ namespace sprout { {}; template - struct container_traits - : public sprout::detail::container_traits_default - {}; + struct container_traits { + public: + typedef T value_type; +#if SPROUT_USE_PTR_INDEX_ITERATOR_IMPLEMENTATION + typedef sprout::ptr_index_iterator iterator; + typedef sprout::ptr_index_iterator 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 + SPROUT_CONSTEXPR_OR_CONST typename sprout::container_traits::size_type + sprout::container_traits::static_size; template struct container_traits : public sprout::detail::container_traits_const_default diff --git a/sprout/container/detail/range_at.hpp b/sprout/container/detail/range_at.hpp new file mode 100644 index 00000000..402ae5c3 --- /dev/null +++ b/sprout/container/detail/range_at.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + sprout::not_found_via_adl range_at(...); +} // namespace sprout_adl + +namespace sprout { + namespace detail { + template + struct has_mem_at_test { + public: + template< + typename U = T, + typename = typename sprout::identity().at(std::declval::size_type>()))>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_at + : public Base_ + {}; +#else + template + struct has_mem_at + : public sprout::identity::test(0))>::type + {}; +#endif + + template + struct is_substitutable_const_at + : public sprout::bool_constant< + sprout::is_const_cast_convertible< + typename sprout::container_traits::reference, + typename sprout::container_traits::reference + >::value + && ( + sprout::detail::has_mem_at::value + || sprout::detail::has_mem_subscript::value + || sprout::detail::has_mem_begin::value + || sprout::detail::has_adl_begin_without_sprout::value + ) + > + {}; + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::is_substitutable_const_at::value, + typename sprout::container_traits::reference + >::type + range_at_impl(Container& cont, typename sprout::container_traits::size_type i) { + typedef typename sprout::container_traits::reference type; + return const_cast(sprout::at(sprout::as_const(cont), i)); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_at::value + && sprout::detail::has_mem_at::value + , + typename sprout::container_traits::reference + >::type + range_at_impl(Container& cont, typename sprout::container_traits::size_type i) { + return cont.at(i); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_at::value + && !sprout::detail::has_mem_at::value + && sprout::detail::has_mem_subscript::value + , + typename sprout::container_traits::reference + >::type + range_at_impl(Container& cont, typename sprout::container_traits::size_type i) { + return cont[sprout::range_index_check(cont, i)]; + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_at::value + && !sprout::detail::has_mem_at::value + && !sprout::detail::has_mem_subscript::value + , + typename sprout::container_traits::reference + >::type + range_at_impl(Container& cont, typename sprout::container_traits::size_type i) { + return *sprout::next(sprout::begin(cont), sprout::range_index_check(cont, i)); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_at::value, + typename sprout::container_traits::reference + >::type + range_at_impl(Container const& cont, typename sprout::container_traits::size_type i) { + return cont.at(i); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_at::value + && sprout::detail::has_mem_subscript::value + , + typename sprout::container_traits::reference + >::type + range_at_impl(Container const& cont, typename sprout::container_traits::size_type i) { + return cont[sprout::range_index_check(cont, i)]; + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_at::value + && !sprout::detail::has_mem_subscript::value + , + typename sprout::container_traits::reference + >::type + range_at_impl(Container const& cont, typename sprout::container_traits::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 + inline SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_at(Container& cont, typename sprout::container_traits::size_type i) { + return sprout::detail::range_at_impl(cont, i); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_at(Container const& cont, typename sprout::container_traits::size_type i) { + return sprout::detail::range_at_impl(cont, i); + } +} // namespace sprout_container_range_detail + +#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_AT_HPP diff --git a/sprout/container/detail/range_back.hpp b/sprout/container/detail/range_back.hpp new file mode 100644 index 00000000..26df30ad --- /dev/null +++ b/sprout/container/detail/range_back.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + sprout::not_found_via_adl range_back(...); +} // namespace sprout_adl + +namespace sprout { + namespace detail { + template + struct has_mem_back_test { + public: + template< + typename U = T, + typename = typename sprout::identity().back())>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_back + : public Base_ + {}; +#else + template + struct has_mem_back + : public sprout::identity::test(0))>::type + {}; +#endif + + template + struct is_substitutable_const_back + : public sprout::bool_constant< + sprout::is_const_cast_convertible< + typename sprout::container_traits::reference, + typename sprout::container_traits::reference + >::value + && ( + sprout::detail::has_mem_back::value + || sprout::detail::has_mem_begin::value + || sprout::detail::has_adl_begin_without_sprout::value + ) + > + {}; + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::is_substitutable_const_back::value, + typename sprout::container_traits::reference + >::type + range_back_impl(Container& cont) { + typedef typename sprout::container_traits::reference type; + return const_cast(sprout::back(sprout::as_const(cont))); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_back::value + && sprout::detail::has_mem_back::value + , + typename sprout::container_traits::reference + >::type + range_back_impl(Container& cont) { + return cont.back(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_back::value + && !sprout::detail::has_mem_back::value + , + typename sprout::container_traits::reference + >::type + range_back_impl(Container& cont) { + return *sprout::begin(cont); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_back::value, + typename sprout::container_traits::reference + >::type + range_back_impl(Container const& cont) { + return cont.back(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_back::value, + typename sprout::container_traits::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 + inline SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_back(Container& cont) { + return sprout::detail::range_back_impl(cont); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::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 diff --git a/sprout/container/detail/range_begin.hpp b/sprout/container/detail/range_begin.hpp new file mode 100644 index 00000000..85be8c7c --- /dev/null +++ b/sprout/container/detail/range_begin.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 + struct has_adl_begin_test { + public: + template< + typename U = T, + typename R = typename sprout::identity()))>::type + > + static sprout::is_found_via_adl test(int); + static sprout::false_type test(...); + }; + + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_adl_begin(Container& cont) { + return begin(cont); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::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::test(0))>::type> + struct has_adl_begin + : public Base_ + {}; +#else + template + struct has_adl_begin + : public sprout::identity::test(0))>::type + {}; +#endif + template::value> + struct has_adl_begin_without_sprout + : public sprout::false_type + {}; + template + struct has_adl_begin_without_sprout + : public sprout::detail::has_adl_begin + {}; + + template + struct has_mem_begin_test { + public: + template< + typename U = T, + typename = typename sprout::identity().begin())>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_begin + : public Base_ + {}; +#else + template + struct has_mem_begin + : public sprout::identity::test(0))>::type + {}; +#endif + + template + struct is_substitutable_const_begin + : public sprout::bool_constant< + sprout::is_const_iterator_cast_convertible< + typename sprout::container_traits::iterator, + typename sprout::container_traits::iterator + >::value + && ( + sprout::detail::has_mem_begin::value + || sprout::detail::has_adl_begin_without_sprout::value + ) + > + {}; + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::is_substitutable_const_begin::value, + typename sprout::container_traits::iterator + >::type + range_begin_impl(Container& cont) { + typedef typename sprout::container_traits::iterator type; + return sprout::const_iterator_cast(sprout::begin(sprout::as_const(cont))); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_begin::value + && sprout::detail::has_mem_begin::value + , + typename sprout::container_traits::iterator + >::type + range_begin_impl(Container& cont) { + return cont.begin(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_begin::value + && !sprout::detail::has_mem_begin::value + && sprout::detail::has_adl_begin_without_sprout::value + , + typename sprout::container_traits::iterator + >::type + range_begin_impl(Container& cont) { + return sprout_container_range_detail::range_adl_begin(cont); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_begin::value + && !sprout::detail::has_mem_begin::value + && !sprout::detail::has_adl_begin_without_sprout::value + , + typename sprout::container_traits::iterator + >::type + range_begin_impl(Container& cont) { + return std::begin(cont); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_begin::value, + typename sprout::container_traits::iterator + >::type + range_begin_impl(Container const& cont) { + return cont.begin(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_begin::value + && sprout::detail::has_adl_begin_without_sprout::value + , + typename sprout::container_traits::iterator + >::type + range_begin_impl(Container const& cont) { + return sprout_container_range_detail::range_adl_begin(cont); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_begin::value + && !sprout::detail::has_adl_begin_without_sprout::value + , + typename sprout::container_traits::iterator + >::type + range_begin_impl(Container const& cont) { + return std::begin(cont); + } + } // namespace detail +} // namespace sprout + +namespace sprout_container_range_detail { + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_begin(Container& cont) { + return sprout::detail::range_begin_impl(cont); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::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 diff --git a/sprout/container/detail/range_data.hpp b/sprout/container/detail/range_data.hpp new file mode 100644 index 00000000..da1dcb70 --- /dev/null +++ b/sprout/container/detail/range_data.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + sprout::not_found_via_adl range_data(...); +} // namespace sprout_adl + +namespace sprout { + namespace detail { + template + struct has_mem_data_test { + public: + template< + typename U = T, + typename = typename sprout::identity().data())>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_data + : public Base_ + {}; +#else + template + struct has_mem_data + : public sprout::identity::test(0))>::type + {}; +#endif + + template + struct is_substitutable_const_data + : public sprout::bool_constant< + sprout::is_const_cast_convertible< + typename sprout::container_traits::pointer, + typename sprout::container_traits::pointer + >::value + && sprout::detail::has_mem_data::value + > + {}; + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::is_substitutable_const_data::value, + typename sprout::container_traits::pointer + >::type + range_data_impl(Container& cont) { + typedef typename sprout::container_traits::pointer type; + return const_cast(sprout::data(sprout::as_const(cont))); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_data::value, + typename sprout::container_traits::pointer + >::type + range_data_impl(Container& cont) { + return cont.data(); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer + range_data_impl(Container const& cont) { + return cont.data(); + } + } // namespace detail +} // namespace sprout + +namespace sprout_container_range_detail { + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::pointer + range_data(Container& cont) { + return sprout::detail::range_data_impl(cont); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::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 diff --git a/sprout/container/detail/range_empty.hpp b/sprout/container/detail/range_empty.hpp new file mode 100644 index 00000000..d5eff229 --- /dev/null +++ b/sprout/container/detail/range_empty.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + sprout::not_found_via_adl range_empty(...); +} // namespace sprout_adl + +namespace sprout { + namespace detail { + template + struct has_mem_empty_test { + public: + template< + typename U = T, + typename = typename sprout::identity().empty())>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_empty + : public Base_ + {}; +#else + template + struct has_mem_empty + : public sprout::identity::test(0))>::type + {}; +#endif + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_empty::value, + bool + >::type + range_empty_impl(Container const& cont) { + return cont.empty(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_empty::value, + bool + >::type + range_empty_impl(Container const& cont) { + return sprout::size(cont) == 0; + } + } // namespace detail +} // namespace sprout + +namespace sprout_container_range_detail { + template + 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 diff --git a/sprout/container/detail/range_end.hpp b/sprout/container/detail/range_end.hpp new file mode 100644 index 00000000..28a74e5d --- /dev/null +++ b/sprout/container/detail/range_end.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 + struct has_adl_end_test { + public: + template< + typename U = T, + typename R = typename sprout::identity()))>::type + > + static sprout::is_found_via_adl test(int); + static sprout::false_type test(...); + }; + + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_adl_end(Container& cont) { + return end(cont); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::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::test(0))>::type> + struct has_adl_end + : public Base_ + {}; +#else + template + struct has_adl_end + : public sprout::identity::test(0))>::type + {}; +#endif + template::value> + struct has_adl_end_without_sprout + : public sprout::false_type + {}; + template + struct has_adl_end_without_sprout + : public sprout::detail::has_adl_end + {}; + + template + struct has_mem_end_test { + public: + template< + typename U = T, + typename = typename sprout::identity().end())>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_end + : public Base_ + {}; +#else + template + struct has_mem_end + : public sprout::identity::test(0))>::type + {}; +#endif + + template + struct is_substitutable_const_end + : public sprout::bool_constant< + sprout::is_const_iterator_cast_convertible< + typename sprout::container_traits::iterator, + typename sprout::container_traits::iterator + >::value + && ( + sprout::detail::has_mem_end::value + || sprout::detail::has_adl_end_without_sprout::value + ) + > + {}; + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::is_substitutable_const_end::value, + typename sprout::container_traits::iterator + >::type + range_end_impl(Container& cont) { + typedef typename sprout::container_traits::iterator type; + return sprout::const_iterator_cast(sprout::end(sprout::as_const(cont))); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_end::value + && sprout::detail::has_mem_end::value + , + typename sprout::container_traits::iterator + >::type + range_end_impl(Container& cont) { + return cont.end(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_end::value + && !sprout::detail::has_mem_end::value + && sprout::detail::has_adl_end_without_sprout::value + , + typename sprout::container_traits::iterator + >::type + range_end_impl(Container& cont) { + return sprout_container_range_detail::range_adl_end(cont); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_end::value + && !sprout::detail::has_mem_end::value + && !sprout::detail::has_adl_end_without_sprout::value + , + typename sprout::container_traits::iterator + >::type + range_end_impl(Container& cont) { + return std::end(cont); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_end::value, + typename sprout::container_traits::iterator + >::type + range_end_impl(Container const& cont) { + return cont.end(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_end::value + && sprout::detail::has_adl_end_without_sprout::value + , + typename sprout::container_traits::iterator + >::type + range_end_impl(Container const& cont) { + return sprout_container_range_detail::range_adl_end(cont); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_end::value + && !sprout::detail::has_adl_end_without_sprout::value + , + typename sprout::container_traits::iterator + >::type + range_end_impl(Container const& cont) { + return std::end(cont); + } + } // namespace detail +} // namespace sprout + +namespace sprout_container_range_detail { + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_end(Container& cont) { + return sprout::detail::range_end_impl(cont); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::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 diff --git a/sprout/container/detail/range_front.hpp b/sprout/container/detail/range_front.hpp new file mode 100644 index 00000000..e3c05848 --- /dev/null +++ b/sprout/container/detail/range_front.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + sprout::not_found_via_adl range_front(...); +} // namespace sprout_adl + +namespace sprout { + namespace detail { + template + struct has_mem_front_test { + public: + template< + typename U = T, + typename = typename sprout::identity().front())>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_front + : public Base_ + {}; +#else + template + struct has_mem_front + : public sprout::identity::test(0))>::type + {}; +#endif + + template + struct is_substitutable_const_front + : public sprout::bool_constant< + sprout::is_const_cast_convertible< + typename sprout::container_traits::reference, + typename sprout::container_traits::reference + >::value + && ( + sprout::detail::has_mem_front::value + || sprout::detail::has_mem_begin::value + || sprout::detail::has_adl_begin_without_sprout::value + ) + > + {}; + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::is_substitutable_const_front::value, + typename sprout::container_traits::reference + >::type + range_front_impl(Container& cont) { + typedef typename sprout::container_traits::reference type; + return const_cast(sprout::front(sprout::as_const(cont))); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_front::value + && sprout::detail::has_mem_front::value + , + typename sprout::container_traits::reference + >::type + range_front_impl(Container& cont) { + return cont.front(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_front::value + && !sprout::detail::has_mem_front::value + , + typename sprout::container_traits::reference + >::type + range_front_impl(Container& cont) { + return *sprout::begin(cont); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_front::value, + typename sprout::container_traits::reference + >::type + range_front_impl(Container const& cont) { + return cont.front(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_front::value, + typename sprout::container_traits::reference + >::type + range_front_impl(Container const& cont) { + return *sprout::begin(cont); + } + } // namespace detail +} // namespace sprout + +namespace sprout_container_range_detail { + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_front(Container& cont) { + return sprout::detail::range_front_impl(cont); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::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 diff --git a/sprout/container/detail/range_index_of.hpp b/sprout/container/detail/range_index_of.hpp new file mode 100644 index 00000000..4d02ac17 --- /dev/null +++ b/sprout/container/detail/range_index_of.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + sprout::not_found_via_adl range_index_of(...); +} // namespace sprout_adl + +namespace sprout { + namespace detail { + template + struct has_mem_index_of_test { + public: + template< + typename U = T, + typename = typename sprout::identity().index_of(std::declval::iterator>()))>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_index_of + : public Base_ + {}; +#else + template + struct has_mem_index_of + : public sprout::identity::test(0))>::type + {}; +#endif + + template + struct is_substitutable_const_index_of + : public sprout::bool_constant< + sprout::is_const_iterator_cast_convertible< + typename sprout::container_traits::iterator, + typename sprout::container_traits::iterator + >::value + && ( + sprout::detail::has_mem_index_of::value + || sprout::detail::has_mem_begin::value + || sprout::detail::has_adl_begin_without_sprout::value + ) + > + {}; + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::is_substitutable_const_index_of::value, + typename sprout::container_traits::size_type + >::type + range_index_of_impl(Container& cont, typename sprout::container_traits::iterator p) { + typedef typename sprout::container_traits::iterator type; + return sprout::index_of(sprout::as_const(cont), sprout::const_iterator_cast(p)); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_index_of::value + && sprout::detail::has_mem_index_of::value + , + typename sprout::container_traits::size_type + >::type + range_index_of_impl(Container& cont, typename sprout::container_traits::iterator p) { + return cont.index_of(p); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_index_of::value + && !sprout::detail::has_mem_index_of::value + , + typename sprout::container_traits::size_type + >::type + range_index_of_impl(Container& cont, typename sprout::container_traits::iterator p) { + return sprout::distance(sprout::begin(cont), p); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_index_of::value, + typename sprout::container_traits::size_type + >::type + range_index_of_impl(Container const& cont, typename sprout::container_traits::iterator p) { + return cont.index_of(p); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_index_of::value, + typename sprout::container_traits::size_type + >::type + range_index_of_impl(Container const& cont, typename sprout::container_traits::iterator p) { + return sprout::distance(sprout::begin(cont), p); + } + } // namespace detail +} // namespace sprout + +namespace sprout_container_range_detail { + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::size_type + range_index_of(Container& cont, typename sprout::container_traits::iterator p) { + return sprout::detail::range_index_of_impl(cont, p); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::size_type + range_index_of(Container const& cont, typename sprout::container_traits::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 diff --git a/sprout/container/detail/range_nth.hpp b/sprout/container/detail/range_nth.hpp new file mode 100644 index 00000000..c833d471 --- /dev/null +++ b/sprout/container/detail/range_nth.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + sprout::not_found_via_adl range_nth(...); +} // namespace sprout_adl + +namespace sprout { + namespace detail { + template + struct has_mem_nth_test { + public: + template< + typename U = T, + typename = typename sprout::identity().nth(std::declval::size_type>()))>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_nth + : public Base_ + {}; +#else + template + struct has_mem_nth + : public sprout::identity::test(0))>::type + {}; +#endif + + template + struct is_substitutable_const_nth + : public sprout::bool_constant< + sprout::is_const_iterator_cast_convertible< + typename sprout::container_traits::iterator, + typename sprout::container_traits::iterator + >::value + && ( + sprout::detail::has_mem_nth::value + || sprout::detail::has_mem_begin::value + || sprout::detail::has_adl_begin_without_sprout::value + ) + > + {}; + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::is_substitutable_const_nth::value, + typename sprout::container_traits::iterator + >::type + range_nth_impl(Container& cont, typename sprout::container_traits::size_type i) { + typedef typename sprout::container_traits::iterator type; + return sprout::const_iterator_cast(sprout::nth(sprout::as_const(cont), i)); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_nth::value + && sprout::detail::has_mem_nth::value + , + typename sprout::container_traits::iterator + >::type + range_nth_impl(Container& cont, typename sprout::container_traits::size_type i) { + return cont.nth(i); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_nth::value + && !sprout::detail::has_mem_nth::value + , + typename sprout::container_traits::iterator + >::type + range_nth_impl(Container& cont, typename sprout::container_traits::size_type i) { + return sprout::next(sprout::begin(cont), i); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_nth::value, + typename sprout::container_traits::iterator + >::type + range_nth_impl(Container const& cont, typename sprout::container_traits::size_type i) { + return cont.nth(i); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_nth::value, + typename sprout::container_traits::iterator + >::type + range_nth_impl(Container const& cont, typename sprout::container_traits::size_type i) { + return sprout::next(sprout::begin(cont), i); + } + } // namespace detail +} // namespace sprout + +namespace sprout_container_range_detail { + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_nth(Container& cont, typename sprout::container_traits::size_type i) { + return sprout::detail::range_nth_impl(cont, i); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::iterator + range_nth(Container const& cont, typename sprout::container_traits::size_type i) { + return sprout::detail::range_nth_impl(cont, i); + } +} // namespace sprout_container_range_detail + +#endif // #ifndef SPROUT_CONTAINER_DETAIL_RANGE_NTH_HPP diff --git a/sprout/container/detail/range_size.hpp b/sprout/container/detail/range_size.hpp new file mode 100644 index 00000000..e2cf6457 --- /dev/null +++ b/sprout/container/detail/range_size.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + sprout::not_found_via_adl range_size(...); +} // namespace sprout_adl + +namespace sprout { + namespace detail { + template + struct has_mem_size_test { + public: + template< + typename U = T, + typename = typename sprout::identity().size())>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_size + : public Base_ + {}; +#else + template + struct has_mem_size + : public sprout::identity::test(0))>::type + {}; +#endif + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_size::value, + typename sprout::container_traits::size_type + >::type + range_size_impl(Container const& cont) { + return cont.size(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_size::value, + typename sprout::container_traits::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 + inline SPROUT_CONSTEXPR typename sprout::container_traits::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 diff --git a/sprout/container/detail/range_subscript_at.hpp b/sprout/container/detail/range_subscript_at.hpp new file mode 100644 index 00000000..3ccc2001 --- /dev/null +++ b/sprout/container/detail/range_subscript_at.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + sprout::not_found_via_adl range_subscript_at(...); +} // namespace sprout_adl + +namespace sprout { + namespace detail { + template + struct has_mem_subscript_test { + public: + template< + typename U = T, + typename = typename sprout::identity()[std::declval::size_type>()])>::type + > + static sprout::true_type test(int); + static sprout::false_type test(...); + }; +#if defined(_MSC_VER) && (_MSC_VER > 1900) + template::test(0))>::type> + struct has_mem_subscript + : public Base_ + {}; +#else + template + struct has_mem_subscript + : public sprout::identity::test(0))>::type + {}; +#endif + + template + struct is_substitutable_const_subscript_at + : public sprout::bool_constant< + sprout::is_const_cast_convertible< + typename sprout::container_traits::reference, + typename sprout::container_traits::reference + >::value + && ( + sprout::detail::has_mem_subscript::value + || sprout::detail::has_mem_begin::value + || sprout::detail::has_adl_begin_without_sprout::value + ) + > + {}; + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::is_substitutable_const_subscript_at::value, + typename sprout::container_traits::reference + >::type + range_subscript_at_impl(Container& cont, typename sprout::container_traits::size_type i) { + typedef typename sprout::container_traits::reference type; + return const_cast(sprout::subscript_at(sprout::as_const(cont), i)); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_subscript_at::value + && sprout::detail::has_mem_subscript::value + , + typename sprout::container_traits::reference + >::type + range_subscript_at_impl(Container& cont, typename sprout::container_traits::size_type i) { + return cont[i]; + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::is_substitutable_const_subscript_at::value + && !sprout::detail::has_mem_subscript::value + , + typename sprout::container_traits::reference + >::type + range_subscript_at_impl(Container& cont, typename sprout::container_traits::size_type i) { + return *sprout::next(sprout::begin(cont), i); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::detail::has_mem_subscript::value, + typename sprout::container_traits::reference + >::type + range_subscript_at_impl(Container const& cont, typename sprout::container_traits::size_type i) { + return cont[i]; + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::detail::has_mem_subscript::value, + typename sprout::container_traits::reference + >::type + range_subscript_at_impl(Container const& cont, typename sprout::container_traits::size_type i) { + return *sprout::next(sprout::begin(cont), i); + } + } // namespace detail +} // namespace sprout + +namespace sprout_container_range_detail { + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_subscript_at(Container& cont, typename sprout::container_traits::size_type i) { + return sprout::detail::range_subscript_at_impl(cont, i); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::reference + range_subscript_at(Container const& cont, typename sprout::container_traits::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 diff --git a/sprout/container/range_functions_fwd.hpp b/sprout/container/range_functions_fwd.hpp index c0e99e9d..db67219e 100644 --- a/sprout/container/range_functions_fwd.hpp +++ b/sprout/container/range_functions_fwd.hpp @@ -131,7 +131,4 @@ namespace sprout { shrink_to_fit(Container&& cont); } // namespace sprout -#include -#include - #endif // #ifndef SPROUT_CONTAINER_RANGE_FUNCTIONS_FWD_HPP diff --git a/sprout/container/range_index_check.hpp b/sprout/container/range_index_check.hpp index 57908d87..bc4990b8 100644 --- a/sprout/container/range_index_check.hpp +++ b/sprout/container/range_index_check.hpp @@ -20,8 +20,8 @@ namespace sprout { template inline SPROUT_CONSTEXPR typename sprout::container_traits::size_type range_index_check(Container const& cont, typename sprout::container_traits::size_type i) { - return i >= sprout::size(cont) ? throw std::out_of_range("range_index_check: index out of range") - : i + return i < sprout::size(cont) ? i + : throw std::out_of_range("range_index_check: index out of range") ; } } // namespace sprout diff --git a/sprout/container/sscrisk/cel/array.hpp b/sprout/container/sscrisk/cel/array.hpp index 6419a8f4..9310a758 100644 --- a/sprout/container/sscrisk/cel/array.hpp +++ b/sprout/container/sscrisk/cel/array.hpp @@ -25,7 +25,7 @@ namespace sprout { // template struct container_traits > - : public sprout::detail::container_traits_default > + : public sprout::container_traits_default > { public: typedef sprout::index_iterator&, true, sprout::detail::const_subscript<> > iterator; diff --git a/sprout/container/std/array.hpp b/sprout/container/std/array.hpp index 911ee21b..11b18085 100644 --- a/sprout/container/std/array.hpp +++ b/sprout/container/std/array.hpp @@ -26,7 +26,7 @@ namespace sprout { // template struct container_traits > - : public sprout::detail::container_traits_default > + : public sprout::container_traits_default > { public: typedef sprout::index_iterator&, true, sprout::detail::const_subscript<> > iterator; @@ -38,10 +38,8 @@ namespace sprout { // template struct container_range_traits > - : public sprout::detail::container_range_traits_default > + : public sprout::container_range_traits_default > { - private: - typedef sprout::detail::container_range_traits_default > base_type; public: // iterators: static SPROUT_CONSTEXPR typename sprout::container_traits >::iterator diff --git a/sprout/container/std/complex.hpp b/sprout/container/std/complex.hpp index 9ab2bdde..444fd2fc 100644 --- a/sprout/container/std/complex.hpp +++ b/sprout/container/std/complex.hpp @@ -63,7 +63,7 @@ namespace sprout { // template struct container_range_traits > - : public sprout::detail::container_range_traits_default > + : public sprout::container_range_traits_default > { public: static SPROUT_CONSTEXPR typename sprout::container_traits >::iterator diff --git a/sprout/range/range_container.hpp b/sprout/range/range_container.hpp index dabfb564..c6472f9c 100644 --- a/sprout/range/range_container.hpp +++ b/sprout/range/range_container.hpp @@ -163,7 +163,7 @@ namespace sprout { // template struct container_traits > - : public sprout::detail::container_traits_default > + : public sprout::container_traits_default > {}; } // namespace sprout diff --git a/sprout/rational/container.hpp b/sprout/rational/container.hpp index 9d2bd1b2..cc0e8d45 100644 --- a/sprout/rational/container.hpp +++ b/sprout/rational/container.hpp @@ -63,7 +63,7 @@ namespace sprout { // template struct container_range_traits > - : public sprout::detail::container_range_traits_default > + : public sprout::container_range_traits_default > { public: static SPROUT_CONSTEXPR typename sprout::container_traits >::iterator