From 20c47b8d6150a811073731f4929818967471aaf9 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 2 Jan 2017 05:13:58 +0000 Subject: [PATCH] better support for plain pointer iterators in containers.hh use std::iterator_traits::value_type instead of T::value_type that will fail when T is not of class type. --- src/containers.hh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/containers.hh b/src/containers.hh index 621dd480..f093bd8f 100644 --- a/src/containers.hh +++ b/src/containers.hh @@ -61,7 +61,7 @@ struct FilterView using ContainerIt = IteratorOf; struct Iterator : std::iterator + typename std::iterator_traits::value_type> { Iterator(const FilterView& view, ContainerIt it, ContainerIt end) : m_it{std::move(it)}, m_end{std::move(end)}, m_view{view} @@ -254,12 +254,13 @@ struct ConcatView { using ContainerIt1 = decltype(begin(std::declval())); using ContainerIt2 = decltype(begin(std::declval())); - using ValueType = typename std::common_type::type; + using ValueType = typename std::common_type::value_type, + typename std::iterator_traits::value_type>::type; struct Iterator : std::iterator { - static_assert(std::is_convertible::value, ""); - static_assert(std::is_convertible::value, ""); + static_assert(std::is_convertible::value_type, ValueType>::value, ""); + static_assert(std::is_convertible::value_type, ValueType>::value, ""); Iterator(ContainerIt1 it1, ContainerIt1 end1, ContainerIt2 it2) : m_it1(std::move(it1)), m_end1(std::move(end1)),