diff options
Diffstat (limited to 'lib/libcxx/include/regex')
-rw-r--r-- | lib/libcxx/include/regex | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/lib/libcxx/include/regex b/lib/libcxx/include/regex index ff84b2738b7..dcdb14af9af 100644 --- a/lib/libcxx/include/regex +++ b/lib/libcxx/include/regex @@ -192,6 +192,11 @@ public: void swap(basic_regex&); }; +template<class ForwardIterator> +basic_regex(ForwardIterator, ForwardIterator, + regex_constants::syntax_option_type = regex_constants::ECMAScript) + -> basic_regex<typename iterator_traits<ForwardIterator>::value_type>; // C++17 + typedef basic_regex<char> regex; typedef basic_regex<wchar_t> wregex; @@ -963,7 +968,7 @@ public: }; template <regex_constants::error_type _Ev> -_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE +_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_regex_error() { #ifndef _LIBCPP_NO_EXCEPTIONS @@ -2409,20 +2414,17 @@ __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const goto __exit; } } - // set of "__found" chars = + // When there's at least one of __neg_chars_ and __neg_mask_, the set + // of "__found" chars is // union(complement(union(__neg_chars_, __neg_mask_)), // other cases...) // - // __neg_chars_ and __neg_mask_'d better be handled together, as there - // are no short circuit opportunities. - // - // In addition, when __neg_mask_/__neg_chars_ is empty, they should be - // treated as all ones/all chars. + // It doesn't make sense to check this when there are no __neg_chars_ + // and no __neg_mask_. + if (!(__neg_mask_ == 0 && __neg_chars_.empty())) { - const bool __in_neg_mask = (__neg_mask_ == 0) || - __traits_.isctype(__ch, __neg_mask_); + const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_); const bool __in_neg_chars = - __neg_chars_.empty() || std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) != __neg_chars_.end(); if (!(__in_neg_mask || __in_neg_chars)) @@ -2922,6 +2924,15 @@ private: template <class, class> friend class __lookahead; }; +#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES +template <class _ForwardIterator, + class = typename enable_if<__is_forward_iterator<_ForwardIterator>::value, nullptr_t>::type +> +basic_regex(_ForwardIterator, _ForwardIterator, + regex_constants::syntax_option_type = regex_constants::ECMAScript) + -> basic_regex<typename iterator_traits<_ForwardIterator>::value_type>; +#endif + template <class _CharT, class _Traits> const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase; template <class _CharT, class _Traits> @@ -4013,7 +4024,7 @@ basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first, char_class_type __class_type = __traits_.lookup_classname(__first, __temp, __flags_ & icase); if (__class_type == 0) - __throw_regex_error<regex_constants::error_brack>(); + __throw_regex_error<regex_constants::error_ctype>(); __ml->__add_class(__class_type); __first = _VSTD::next(__temp, 2); return __first; |