On 8 November 2013 16:03, Jonathan Wakely wrote: > On 8 November 2013 15:41, Jonathan Wakely wrote: >> On 8 November 2013 14:51, Daniel Krügler wrote: >>> I have fully not grasped for which T the specializations of >>> __has_contiguous_iter are intended to be used, >> >> Currently, only std::container iterators passed to a basic_regex >> constructor, but in theory the trait could get moved to another header >> and used elsewhere in future. > > Currently the vector<bool> specialization can never be reached, > because std::vector<bool> doesn't use __gnu_cxx::__normal_iterator > (and trying to pass vector<bool>::iterator to a regex ctor fails > anyway) so this is only a theoretical problem if we re-use > __has_contiguous_iter elsewhere.
I've fixed the trait anyway, like so: 2013-11-08 Jonathan Wakely <jwakely....@gmail.com> * include/bits/regex_compiler.h (__detail::__has_contiguous_iter): vector<bool> storage is not contiguous. Tested x86_64-linux, committed to trunk.
diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h index 741098f..b9f8127 100644 --- a/libstdc++-v3/include/bits/regex_compiler.h +++ b/libstdc++-v3/include/bits/regex_compiler.h @@ -134,12 +134,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Ch, typename _Tr, typename _Alloc> struct __has_contiguous_iter<std::basic_string<_Ch, _Tr, _Alloc>> - : std::true_type + : std::true_type // string<Ch> storage is contiguous { }; template<typename _Tp, typename _Alloc> struct __has_contiguous_iter<std::vector<_Tp, _Alloc>> - : std::true_type + : std::true_type // vector<Tp> storage is contiguous + { }; + + template<typename _Alloc> + struct __has_contiguous_iter<std::vector<bool, _Alloc>> + : std::false_type // vector<bool> storage is not contiguous { }; template<typename _Tp>