diff --git a/src/tools/ranges/IteratorView.hpp b/src/tools/ranges/IteratorView.hpp index 3359456..c32986d 100644 --- a/src/tools/ranges/IteratorView.hpp +++ b/src/tools/ranges/IteratorView.hpp @@ -29,6 +29,7 @@ class IteratorView : public ViewBase< IteratorView< Iterator > > { using reference = typename std::iterator_traits< Iterator >::reference; using const_reference = const reference; using iterator = Iterator; + using const_iterator = const Iterator; private: diff --git a/src/tools/ranges/TransformView.hpp b/src/tools/ranges/TransformView.hpp index ce0ee57..27f8a13 100644 --- a/src/tools/ranges/TransformView.hpp +++ b/src/tools/ranges/TransformView.hpp @@ -24,7 +24,7 @@ template < typename Range, typename Transform > class TransformView : public ViewBase< TransformView< Range, Transform > > { /* type aliases */ - using BaseIterator = typename Range::const_iterator; + using BaseIterator = decltype( std::cbegin( std::declval< Range& >() ) ); /* fields */ Range base_; @@ -41,6 +41,7 @@ class TransformView : public ViewBase< TransformView< Range, Transform > > { using reference = typename std::iterator_traits< Iterator >::reference; using const_reference = const reference; using iterator = Iterator; + using const_iterator = const Iterator; /* constructor */ diff --git a/src/tools/ranges/make_transform_view.hpp b/src/tools/ranges/make_transform_view.hpp index 34600ad..4943d66 100644 --- a/src/tools/ranges/make_transform_view.hpp +++ b/src/tools/ranges/make_transform_view.hpp @@ -4,6 +4,7 @@ // system includes // other includes +#include "tools/ranges/IteratorView.hpp" #include "tools/ranges/TransformView.hpp" namespace njoy { @@ -20,7 +21,8 @@ template < typename Container, typename Transformation > constexpr auto make_transform_view( Container&& container, Transformation transformation ) { - return TransformView( container, std::move( transformation ) ); + return TransformView( IteratorView( container.cbegin(), container.cend() ), + std::move( transformation ) ); } } // ranges namespace