diff --git a/unit_test/view_gtest.cpp b/unit_test/view_gtest.cpp index d6098ca9..924039bd 100644 --- a/unit_test/view_gtest.cpp +++ b/unit_test/view_gtest.cpp @@ -58,7 +58,7 @@ TEST(viewTest, countedView) #endif { oel::dynarray i{1, 2}; - oel::counted_view::const_iterator> test = i; + auto test = view::counted(i.begin(), i.size()); EXPECT_EQ(i.size(), test.size()); EXPECT_EQ(1, test[0]); EXPECT_EQ(2, test[1]); diff --git a/view/counted.h b/view/counted.h index f13014c8..d777fc09 100644 --- a/view/counted.h +++ b/view/counted.h @@ -6,7 +6,6 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#include "../util.h" #include "detail/misc.h" /** @file @@ -26,14 +25,8 @@ class counted_view counted_view() = default; constexpr counted_view(Iterator f, difference_type n) : _begin{std::move(f)}, _size{n} {} - //! Construct from range (lvalue) that knows its size, with matching iterator type - template< typename SizedRange, - enable_if< !std::is_base_of::value > = 0 // avoid being selected for copy - > - constexpr counted_view(SizedRange & r) : _begin(oel::adl_begin(r)), _size(oel::ssize(r)) {} - constexpr Iterator begin() { return _detail::MoveIfNotCopyable(_begin); } - constexpr Iterator begin() const OEL_ALWAYS_INLINE { return _begin; } + constexpr Iterator begin() { return _detail::MoveIfNotCopyable(_begin); } //! Provided only if Iterator is random-access template< typename I = Iterator, enable_if< iter_is_random_access > = 0 diff --git a/view/subrange.h b/view/subrange.h index 70cade4b..ef456bee 100644 --- a/view/subrange.h +++ b/view/subrange.h @@ -25,10 +25,9 @@ class basic_view basic_view() = default; constexpr basic_view(Iterator f, Sentinel l) : _begin{std::move(f)}, _end{l} {} - constexpr Iterator begin() { return _detail::MoveIfNotCopyable(_begin); } - constexpr Iterator begin() const OEL_ALWAYS_INLINE { return _begin; } + constexpr Iterator begin() { return _detail::MoveIfNotCopyable(_begin); } - constexpr Sentinel end() const OEL_ALWAYS_INLINE { return _end; } + constexpr Sentinel end() const OEL_ALWAYS_INLINE { return _end; } //! Provided only if begin() can be subtracted from end() template< typename I = Iterator,