diff --git a/include/boost/regex/v5/basic_regex_parser.hpp b/include/boost/regex/v5/basic_regex_parser.hpp index a3e0b3c6..2a13f2f5 100644 --- a/include/boost/regex/v5/basic_regex_parser.hpp +++ b/include/boost/regex/v5/basic_regex_parser.hpp @@ -115,7 +115,7 @@ private: #if defined(BOOST_MSVC) && defined(_M_IX86) // This is an ugly warning suppression workaround (for warnings *inside* std::vector // that can not otherwise be suppressed)... - BOOST_STATIC_ASSERT(sizeof(long) >= sizeof(void*)); + static_assert(sizeof(long) >= sizeof(void*), "Long isn't long enough!"); std::vector m_alt_jumps; // list of alternative in the current scope. #else std::vector m_alt_jumps; // list of alternative in the current scope. diff --git a/include/boost/regex/v5/cpp_regex_traits.hpp b/include/boost/regex/v5/cpp_regex_traits.hpp index 03c38b89..0a523ac6 100644 --- a/include/boost/regex/v5/cpp_regex_traits.hpp +++ b/include/boost/regex/v5/cpp_regex_traits.hpp @@ -632,7 +632,7 @@ typename cpp_regex_traits_implementation::string_type // is to replace each character with 2, fortunately this code isn't used that // much as this is now slower than before :-( // - typedef typename make_unsigned::type uchar_type; + typedef typename std::make_unsigned::type uchar_type; result2.reserve(result.size() * 2 + 2); for(unsigned i = 0; i < result.size(); ++i) { diff --git a/include/boost/regex/v5/iterator_traits.hpp b/include/boost/regex/v5/iterator_traits.hpp index 1ece5c17..7b0704ca 100644 --- a/include/boost/regex/v5/iterator_traits.hpp +++ b/include/boost/regex/v5/iterator_traits.hpp @@ -33,90 +33,9 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{ -#if defined(BOOST_NO_STD_ITERATOR_TRAITS) - -template -struct regex_iterator_traits -{ - typedef typename T::iterator_category iterator_category; - typedef typename T::value_type value_type; -#if !defined(BOOST_NO_STD_ITERATOR) - typedef typename T::difference_type difference_type; - typedef typename T::pointer pointer; - typedef typename T::reference reference; -#else - typedef std::ptrdiff_t difference_type; - typedef value_type* pointer; - typedef value_type& reference; -#endif -}; - -template -struct pointer_iterator_traits -{ - typedef std::ptrdiff_t difference_type; - typedef T value_type; - typedef T* pointer; - typedef T& reference; - typedef std::random_access_iterator_tag iterator_category; -}; -template -struct const_pointer_iterator_traits -{ - typedef std::ptrdiff_t difference_type; - typedef T value_type; - typedef const T* pointer; - typedef const T& reference; - typedef std::random_access_iterator_tag iterator_category; -}; - -template<> -struct regex_iterator_traits : pointer_iterator_traits{}; -template<> -struct regex_iterator_traits : const_pointer_iterator_traits{}; -template<> -struct regex_iterator_traits : pointer_iterator_traits{}; -template<> -struct regex_iterator_traits : const_pointer_iterator_traits{}; -// -// the follwoing are needed for ICU support: -// -template<> -struct regex_iterator_traits : pointer_iterator_traits{}; -template<> -struct regex_iterator_traits : const_pointer_iterator_traits{}; -template<> -struct regex_iterator_traits : pointer_iterator_traits{}; -template<> -struct regex_iterator_traits : const_pointer_iterator_traits{}; - -#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -template<> -struct regex_iterator_traits : pointer_iterator_traits{}; -template<> -struct regex_iterator_traits : const_pointer_iterator_traits{}; -#endif - -#if defined(__SGI_STL_PORT) && defined(__STL_DEBUG) -template<> -struct regex_iterator_traits : pointer_iterator_traits{}; -template<> -struct regex_iterator_traits : const_pointer_iterator_traits{}; -#ifndef BOOST_NO_STD_WSTRING -template<> -struct regex_iterator_traits : pointer_iterator_traits{}; -template<> -struct regex_iterator_traits : const_pointer_iterator_traits{}; -#endif // BOOST_NO_WSTRING -#endif // stport - -#else - template struct regex_iterator_traits : public std::iterator_traits {}; -#endif - } // namespace BOOST_REGEX_DETAIL_NS } // namespace boost diff --git a/include/boost/regex/v5/match_flags.hpp b/include/boost/regex/v5/match_flags.hpp index f750351d..3e31c651 100644 --- a/include/boost/regex/v5/match_flags.hpp +++ b/include/boost/regex/v5/match_flags.hpp @@ -89,12 +89,8 @@ typedef enum _match_flags } match_flags; -#if defined(BOOST_BORLANDC) || (defined(_MSC_VER) && (_MSC_VER <= 1310)) -typedef unsigned long match_flag_type; -#else typedef match_flags match_flag_type; - #ifdef __cplusplus inline match_flags operator&(match_flags m1, match_flags m2) { return static_cast(static_cast(m1) & static_cast(m2)); } @@ -111,7 +107,6 @@ inline match_flags& operator|=(match_flags& m1, match_flags m2) inline match_flags& operator^=(match_flags& m1, match_flags m2) { m1 = m1^m2; return m1; } #endif -#endif #ifdef __cplusplus } /* namespace regex_constants */ diff --git a/include/boost/regex/v5/match_results.hpp b/include/boost/regex/v5/match_results.hpp index d85641ac..09d18b0b 100644 --- a/include/boost/regex/v5/match_results.hpp +++ b/include/boost/regex/v5/match_results.hpp @@ -52,43 +52,25 @@ template class match_results { private: -#ifndef BOOST_NO_STD_ALLOCATOR typedef std::vector, Allocator> vector_type; -#else - typedef std::vector > vector_type; -#endif public: typedef sub_match value_type; -#ifndef BOOST_NO_CXX11_ALLOCATOR typedef typename std::allocator_traits::value_type const & const_reference; -#elif !defined(BOOST_NO_STD_ALLOCATOR) && !(defined(BOOST_MSVC) && defined(_STLPORT_VERSION)) - typedef typename Allocator::const_reference const_reference; -#else - typedef const value_type& const_reference; -#endif typedef const_reference reference; typedef typename vector_type::const_iterator const_iterator; typedef const_iterator iterator; - typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits< + typedef typename std::iterator_traits< BidiIterator>::difference_type difference_type; -#ifdef BOOST_NO_CXX11_ALLOCATOR typedef typename Allocator::size_type size_type; -#else - typedef typename std::allocator_traits::size_type size_type; -#endif typedef Allocator allocator_type; - typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits< + typedef typename std::iterator_traits< BidiIterator>::value_type char_type; typedef std::basic_string string_type; typedef BOOST_REGEX_DETAIL_NS::named_subexpressions named_sub_type; // construct/copy/destroy: explicit match_results(const Allocator& a = Allocator()) -#ifndef BOOST_NO_STD_ALLOCATOR : m_subs(a), m_base(), m_null(), m_last_closed_paren(0), m_is_singular(true) {} -#else - : m_subs(), m_base(), m_null(), m_last_closed_paren(0), m_is_singular(true) { (void)a; } -#endif // // IMPORTANT: in the code below, the crazy looking checks around m_is_singular are // all required because it is illegal to copy a singular iterator. @@ -254,7 +236,7 @@ public: template const_reference named_subexpression(const charT* i, const charT* j) const { - BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type)); + static_assert(sizeof(charT) <= sizeof(char_type), "Failed internal logic"); if(i == j) return m_null; std::vector s; @@ -282,7 +264,7 @@ public: template int named_subexpression_index(const charT* i, const charT* j) const { - BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type)); + static_assert(sizeof(charT) <= sizeof(char_type), "Failed internal logic"); if(i == j) return -20; std::vector s; @@ -305,7 +287,7 @@ public: template const_reference operator[](const charT* p) const { - BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type)); + static_assert(sizeof(charT) <= sizeof(char_type), "Failed internal logic"); if(*p == 0) return m_null; std::vector s; @@ -316,7 +298,7 @@ public: template const_reference operator[](const std::basic_string& ns) const { - BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type)); + static_assert(sizeof(charT) <= sizeof(char_type), "Failed internal logic"); if(ns.empty()) return m_null; std::vector s; @@ -413,11 +395,7 @@ public: allocator_type get_allocator() const { -#ifndef BOOST_NO_STD_ALLOCATOR return m_subs.get_allocator(); -#else - return allocator_type(); -#endif } void swap(match_results& that) { @@ -678,7 +656,6 @@ void swap(match_results& a, match_results std::basic_ostream& operator << (std::basic_ostream& os, @@ -686,14 +663,6 @@ std::basic_ostream& { return (os << s.str()); } -#else -template -std::ostream& operator << (std::ostream& os, - const match_results& s) -{ - return (os << s.str()); -} -#endif #ifdef BOOST_MSVC #pragma warning(pop) diff --git a/include/boost/regex/v5/perl_matcher.hpp b/include/boost/regex/v5/perl_matcher.hpp index 77ae3c00..623608ee 100644 --- a/include/boost/regex/v5/perl_matcher.hpp +++ b/include/boost/regex/v5/perl_matcher.hpp @@ -80,14 +80,12 @@ inline bool can_start(unsigned short c, const unsigned char* map, unsigned char { return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask); } -#if !defined(__hpux) && !defined(__WINSCW__)// WCHAR_MIN not usable in pp-directives. #if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask) { return ((c >= static_cast(1u << CHAR_BIT)) ? true : map[c] & mask); } #endif -#endif #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) inline bool can_start(unsigned int c, const unsigned char* map, unsigned char mask) { @@ -95,16 +93,6 @@ inline bool can_start(unsigned int c, const unsigned char* map, unsigned char ma } #endif - -// -// Unfortunately Rogue Waves standard library appears to have a bug -// in std::basic_string::compare that results in erroneous answers -// in some cases (tested with Borland C++ 5.1, Rogue Wave lib version -// 0x020101) the test case was: -// {39135,0} < {0xff,0} -// which succeeds when it should not. -// -#ifndef _RWSTD_VER template inline int string_compare(const std::basic_string& s, const C* p) { @@ -115,24 +103,6 @@ inline int string_compare(const std::basic_string& s, const C* p) } return s.compare(p); } -#else -template -inline int string_compare(const std::basic_string& s, const C* p) -{ - if(0 == *p) - { - if(s.empty() || ((s.size() == 1) && (s[0] == 0))) - return 0; - } - return s.compare(p); -} -inline int string_compare(const std::string& s, const char* p) -{ return std::strcmp(s.c_str(), p); } -# ifndef BOOST_NO_WREGEX -inline int string_compare(const std::wstring& s, const wchar_t* p) -{ return std::wcscmp(s.c_str(), p); } -#endif -#endif template inline int string_compare(const Seq& s, const C* p) { @@ -388,7 +358,7 @@ public: typedef bool (self_type::*matcher_proc_type)(); typedef std::size_t traits_size_type; typedef typename is_byte::width_type width_type; - typedef typename regex_iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::difference_type difference_type; typedef match_results results_type; perl_matcher(BidiIterator first, BidiIterator end, diff --git a/include/boost/regex/v5/perl_matcher_common.hpp b/include/boost/regex/v5/perl_matcher_common.hpp index b4ddb23a..fa8c5bdf 100644 --- a/include/boost/regex/v5/perl_matcher_common.hpp +++ b/include/boost/regex/v5/perl_matcher_common.hpp @@ -54,7 +54,7 @@ namespace BOOST_REGEX_DETAIL_NS{ template void perl_matcher::construct_init(const basic_regex& e, match_flag_type f) { - typedef typename regex_iterator_traits::iterator_category category; + typedef typename std::iterator_traits::iterator_category category; typedef typename basic_regex::flag_type expression_flag_type; if(e.empty()) @@ -913,26 +913,26 @@ template bool perl_matcher::find_restart_lit() { #if 0 - if(position == last) + if (position == last) return false; // can't possibly match if we're at the end already - unsigned type = (m_match_flags & match_continuous) ? - static_cast(regbase::restart_continue) - : static_cast(re.get_restart_type()); + unsigned type = (m_match_flags & match_continuous) ? + static_cast(regbase::restart_continue) + : static_cast(re.get_restart_type()); const kmp_info* info = access::get_kmp(re); int len = info->len; const char_type* x = info->pstr; - int j = 0; - while (position != last) + int j = 0; + while (position != last) { - while((j > -1) && (x[j] != traits_inst.translate(*position, icase))) + while ((j > -1) && (x[j] != traits_inst.translate(*position, icase))) j = info->kmp_next[j]; ++position; ++j; - if(j >= len) + if (j >= len) { - if(type == regbase::restart_fixed_lit) + if (type == regbase::restart_fixed_lit) { std::advance(position, -j); restart = position; @@ -946,13 +946,14 @@ bool perl_matcher::find_restart_lit() { restart = position; std::advance(position, -j); - if(match_prefix()) + if (match_prefix()) return true; else { - for(int k = 0; (restart != position) && (k < j); ++k, --restart) - {} // dwa 10/20/2000 - warning suppression for MWCW - if(restart != last) + for (int k = 0; (restart != position) && (k < j); ++k, --restart) + { + } // dwa 10/20/2000 - warning suppression for MWCW + if (restart != last) ++restart; position = restart; j = 0; //we could do better than this... @@ -960,7 +961,7 @@ bool perl_matcher::find_restart_lit() } } } - if((m_match_flags & match_partial) && (position == last) && j) + if ((m_match_flags & match_partial) && (position == last) && j) { // we need to check for a partial match: restart = position; diff --git a/include/boost/regex/v5/perl_matcher_non_recursive.hpp b/include/boost/regex/v5/perl_matcher_non_recursive.hpp index 73241b5d..d4417ca7 100644 --- a/include/boost/regex/v5/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v5/perl_matcher_non_recursive.hpp @@ -1868,63 +1868,6 @@ bool perl_matcher::unwind_then(bool b) return false; } -/* -template -bool perl_matcher::unwind_parenthesis_pop(bool r) -{ - saved_state* pmp = static_cast(m_backup_state); - if(!r) - { - --parenthesis_stack_position; - } - boost::BOOST_REGEX_DETAIL_NS::inplace_destroy(pmp++); - m_backup_state = pmp; - return true; -} - -template -void perl_matcher::push_parenthesis_pop() -{ - saved_state* pmp = static_cast(m_backup_state); - --pmp; - if(pmp < m_stack_base) - { - extend_stack(); - pmp = static_cast(m_backup_state); - --pmp; - } - (void) new (pmp)saved_state(16); - m_backup_state = pmp; -} - -template -bool perl_matcher::unwind_parenthesis_push(bool r) -{ - saved_position* pmp = static_cast*>(m_backup_state); - if(!r) - { - parenthesis_stack[parenthesis_stack_position++] = pmp->position; - } - boost::BOOST_REGEX_DETAIL_NS::inplace_destroy(pmp++); - m_backup_state = pmp; - return true; -} - -template -inline void perl_matcher::push_parenthesis_push(BidiIterator p) -{ - saved_position* pmp = static_cast*>(m_backup_state); - --pmp; - if(pmp < m_stack_base) - { - extend_stack(); - pmp = static_cast*>(m_backup_state); - --pmp; - } - (void) new (pmp)saved_position(0, p, 17); - m_backup_state = pmp; -} -*/ } // namespace BOOST_REGEX_DETAIL_NS } // namespace boost diff --git a/include/boost/regex/v5/regex.hpp b/include/boost/regex/v5/regex.hpp index 202065f8..eb6dc728 100644 --- a/include/boost/regex/v5/regex.hpp +++ b/include/boost/regex/v5/regex.hpp @@ -25,65 +25,24 @@ // what follows is all C++ don't include in C builds!! -#ifndef BOOST_REGEX_CONFIG_HPP #include -#endif -#ifndef BOOST_REGEX_WORKAROUND_HPP #include -#endif - -#ifndef BOOST_REGEX_FWD_HPP #include -#endif -#ifndef BOOST_REGEX_TRAITS_HPP #include -#endif -#ifndef BOOST_REGEX_RAW_BUFFER_HPP #include -#endif -#ifndef BOOST_REGEX_V5_MATCH_FLAGS #include -#endif -#ifndef BOOST_REGEX_RAW_BUFFER_HPP #include -#endif -#ifndef BOOST_RE_PAT_EXCEPT_HPP #include -#endif - -#ifndef BOOST_REGEX_V5_CHAR_REGEX_TRAITS_HPP #include -#endif -#ifndef BOOST_REGEX_V5_STATES_HPP #include -#endif -#ifndef BOOST_REGEX_V5_REGBASE_HPP #include -#endif -#ifndef BOOST_REGEX_V5_ITERATOR_TRAITS_HPP -#include -#endif -#ifndef BOOST_REGEX_V5_BASIC_REGEX_HPP #include -#endif -#ifndef BOOST_REGEX_V5_BASIC_REGEX_CREATOR_HPP #include -#endif -#ifndef BOOST_REGEX_V5_BASIC_REGEX_PARSER_HPP #include -#endif -#ifndef BOOST_REGEX_V5_SUB_MATCH_HPP #include -#endif -#ifndef BOOST_REGEX_FORMAT_HPP #include -#endif -#ifndef BOOST_REGEX_V5_MATCH_RESULTS_HPP #include -#endif -#ifndef BOOST_REGEX_MATCHER_HPP #include -#endif namespace boost{ #ifdef BOOST_REGEX_NO_FWD @@ -101,30 +60,15 @@ typedef match_results wsmatch; #endif } // namespace boost -#ifndef BOOST_REGEX_MATCH_HPP + #include -#endif -#ifndef BOOST_REGEX_V5_REGEX_SEARCH_HPP #include -#endif -#ifndef BOOST_REGEX_ITERATOR_HPP #include -#endif -#ifndef BOOST_REGEX_TOKEN_ITERATOR_HPP #include -#endif -#ifndef BOOST_REGEX_V5_REGEX_GREP_HPP #include -#endif -#ifndef BOOST_REGEX_V5_REGEX_REPLACE_HPP #include -#endif -#ifndef BOOST_REGEX_V5_REGEX_MERGE_HPP #include -#endif -#ifndef BOOST_REGEX_SPLIT_HPP #include -#endif #endif // __cplusplus diff --git a/include/boost/regex/v5/regex_format.hpp b/include/boost/regex/v5/regex_format.hpp index c913aded..c66f7692 100644 --- a/include/boost/regex/v5/regex_format.hpp +++ b/include/boost/regex/v5/regex_format.hpp @@ -40,7 +40,7 @@ namespace boost{ // // Forward declaration: // - template >::allocator_type > + template >::allocator_type > class match_results; namespace BOOST_REGEX_DETAIL_NS{ @@ -932,7 +932,7 @@ private: // // F must be a pointer, a function, or a class with a function call operator: // - BOOST_STATIC_ASSERT((::std::is_pointer::value || ::std::is_function::value || ::std::is_class::value)); + static_assert((::std::is_pointer::value || ::std::is_function::value || ::std::is_class::value), "The functor must be a pointer or a class with a function call operator"); static formatter_wrapper::type> f; static M m; static O out; @@ -967,7 +967,7 @@ public: // This static assertion will fail if the functor passed does not accept // the same type of arguments passed. // - BOOST_STATIC_ASSERT( std::is_class::value && !has_const_iterator::value ? (type::value > 1) : true); + static_assert( std::is_class::value && !has_const_iterator::value ? (type::value > 1) : true, "Argument mismatch in Functor type"); }; template diff --git a/include/boost/regex/v5/regex_grep.hpp b/include/boost/regex/v5/regex_grep.hpp index f6997494..851ebd6f 100644 --- a/include/boost/regex/v5/regex_grep.hpp +++ b/include/boost/regex/v5/regex_grep.hpp @@ -86,11 +86,7 @@ inline unsigned int regex_grep(Predicate foo, // // regex_grep convenience interfaces: -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING // -// this isn't really a partial specialisation, but template function -// overloading - if the compiler doesn't support partial specialisation -// then it really won't support this either: template inline unsigned int regex_grep(Predicate foo, const charT* str, const basic_regex& e, @@ -106,37 +102,6 @@ inline unsigned int regex_grep(Predicate foo, const std::basic_string&), const std::string& s, - const regex& e, - match_flag_type flags = match_default) -{ - return regex_grep(foo, s.begin(), s.end(), e, flags); -} -#if !defined(BOOST_NO_WREGEX) -inline unsigned int regex_grep(bool (*foo)(const match_results::const_iterator>&), - const std::basic_string& s, - const wregex& e, - match_flag_type flags = match_default) -{ - return regex_grep(foo, s.begin(), s.end(), e, flags); -} -#endif -#endif #ifdef BOOST_MSVC #pragma warning(push) diff --git a/include/boost/regex/v5/regex_iterator.hpp b/include/boost/regex/v5/regex_iterator.hpp index 317ff1f4..401b4c30 100644 --- a/include/boost/regex/v5/regex_iterator.hpp +++ b/include/boost/regex/v5/regex_iterator.hpp @@ -84,7 +84,7 @@ private: }; template ::value_type, + class charT = typename std::iterator_traits::value_type, class traits = regex_traits > class regex_iterator { @@ -94,7 +94,7 @@ private: public: typedef basic_regex regex_type; typedef match_results value_type; - typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::difference_type + typedef typename std::iterator_traits::difference_type difference_type; typedef const value_type* pointer; typedef const value_type& reference; diff --git a/include/boost/regex/v5/regex_match.hpp b/include/boost/regex/v5/regex_match.hpp index a50daa2a..3aecd946 100644 --- a/include/boost/regex/v5/regex_match.hpp +++ b/include/boost/regex/v5/regex_match.hpp @@ -59,11 +59,7 @@ bool regex_match(iterator first, iterator last, } // // query_match convenience interfaces: -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING // -// this isn't really a partial specialisation, but template function -// overloading - if the compiler doesn't support partial specialisation -// then it really won't support this either: template inline bool regex_match(const charT* str, match_results& m, @@ -99,253 +95,6 @@ inline bool regex_match(const std::basic_string& s, match_results m; return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); } -#else // partial ordering -inline bool regex_match(const char* str, - cmatch& m, - const regex& e, - match_flag_type flags = match_default) -{ - return regex_match(str, str + regex::traits_type::length(str), m, e, flags); -} -inline bool regex_match(const char* str, - const regex& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#ifndef BOOST_NO_STD_LOCALE -inline bool regex_match(const char* str, - cmatch& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(str, str + regex::traits_type::length(str), m, e, flags); -} -inline bool regex_match(const char* str, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#endif -inline bool regex_match(const char* str, - cmatch& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(str, str + regex::traits_type::length(str), m, e, flags); -} -inline bool regex_match(const char* str, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32) -inline bool regex_match(const char* str, - cmatch& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(str, str + regex::traits_type::length(str), m, e, flags); -} -inline bool regex_match(const char* str, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#endif -#ifndef BOOST_NO_WREGEX -inline bool regex_match(const wchar_t* str, - wcmatch& m, - const wregex& e, - match_flag_type flags = match_default) -{ - return regex_match(str, str + wregex::traits_type::length(str), m, e, flags); -} -inline bool regex_match(const wchar_t* str, - const wregex& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#ifndef BOOST_NO_STD_LOCALE -inline bool regex_match(const wchar_t* str, - wcmatch& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(str, str + wregex::traits_type::length(str), m, e, flags); -} -inline bool regex_match(const wchar_t* str, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#endif -inline bool regex_match(const wchar_t* str, - wcmatch& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(str, str + wregex::traits_type::length(str), m, e, flags); -} -inline bool regex_match(const wchar_t* str, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32) -inline bool regex_match(const wchar_t* str, - wcmatch& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(str, str + wregex::traits_type::length(str), m, e, flags); -} -inline bool regex_match(const wchar_t* str, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#endif -#endif -inline bool regex_match(const std::string& s, - smatch& m, - const regex& e, - match_flag_type flags = match_default) -{ - return regex_match(s.begin(), s.end(), m, e, flags); -} -inline bool regex_match(const std::string& s, - const regex& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} -#ifndef BOOST_NO_STD_LOCALE -inline bool regex_match(const std::string& s, - smatch& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(s.begin(), s.end(), m, e, flags); -} -inline bool regex_match(const std::string& s, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} -#endif -inline bool regex_match(const std::string& s, - smatch& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(s.begin(), s.end(), m, e, flags); -} -inline bool regex_match(const std::string& s, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} -#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32) -inline bool regex_match(const std::string& s, - smatch& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(s.begin(), s.end(), m, e, flags); -} -inline bool regex_match(const std::string& s, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results m; - return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} -#endif -#if !defined(BOOST_NO_WREGEX) -inline bool regex_match(const std::basic_string& s, - match_results::const_iterator>& m, - const wregex& e, - match_flag_type flags = match_default) -{ - return regex_match(s.begin(), s.end(), m, e, flags); -} -inline bool regex_match(const std::basic_string& s, - const wregex& e, - match_flag_type flags = match_default) -{ - match_results::const_iterator> m; - return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} -#ifndef BOOST_NO_STD_LOCALE -inline bool regex_match(const std::basic_string& s, - match_results::const_iterator>& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(s.begin(), s.end(), m, e, flags); -} -inline bool regex_match(const std::basic_string& s, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results::const_iterator> m; - return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} -#endif -inline bool regex_match(const std::basic_string& s, - match_results::const_iterator>& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(s.begin(), s.end(), m, e, flags); -} -inline bool regex_match(const std::basic_string& s, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results::const_iterator> m; - return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} -#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32) -inline bool regex_match(const std::basic_string& s, - match_results::const_iterator>& m, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - return regex_match(s.begin(), s.end(), m, e, flags); -} -inline bool regex_match(const std::basic_string& s, - const basic_regex >& e, - match_flag_type flags = match_default) -{ - match_results::const_iterator> m; - return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} -#endif -#endif - -#endif #ifdef BOOST_MSVC diff --git a/include/boost/regex/v5/regex_search.hpp b/include/boost/regex/v5/regex_search.hpp index b508fd46..bbb90490 100644 --- a/include/boost/regex/v5/regex_search.hpp +++ b/include/boost/regex/v5/regex_search.hpp @@ -58,11 +58,7 @@ bool regex_search(BidiIterator first, BidiIterator last, // // regex_search convenience interfaces: -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING // -// this isn't really a partial specialisation, but template function -// overloading - if the compiler doesn't support partial specialisation -// then it really won't support this either: template inline bool regex_search(const charT* str, match_results& m, @@ -80,56 +76,6 @@ inline bool regex_search(const std::basic_string& s, { return regex_search(s.begin(), s.end(), m, e, flags); } -#else // partial overloads: -inline bool regex_search(const char* str, - cmatch& m, - const regex& e, - match_flag_type flags = match_default) -{ - return regex_search(str, str + regex::traits_type::length(str), m, e, flags); -} -inline bool regex_search(const char* first, const char* last, - const regex& e, - match_flag_type flags = match_default) -{ - cmatch m; - return regex_search(first, last, m, e, flags | regex_constants::match_any); -} - -#ifndef BOOST_NO_WREGEX -inline bool regex_search(const wchar_t* str, - wcmatch& m, - const wregex& e, - match_flag_type flags = match_default) -{ - return regex_search(str, str + wregex::traits_type::length(str), m, e, flags); -} -inline bool regex_search(const wchar_t* first, const wchar_t* last, - const wregex& e, - match_flag_type flags = match_default) -{ - wcmatch m; - return regex_search(first, last, m, e, flags | regex_constants::match_any); -} -#endif -inline bool regex_search(const std::string& s, - smatch& m, - const regex& e, - match_flag_type flags = match_default) -{ - return regex_search(s.begin(), s.end(), m, e, flags); -} -#if !defined(BOOST_NO_WREGEX) -inline bool regex_search(const std::basic_string& s, - wsmatch& m, - const wregex& e, - match_flag_type flags = match_default) -{ - return regex_search(s.begin(), s.end(), m, e, flags); -} -#endif - -#endif template bool regex_search(BidiIterator first, BidiIterator last, @@ -145,8 +91,6 @@ bool regex_search(BidiIterator first, BidiIterator last, return matcher.find(); } -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - template inline bool regex_search(const charT* str, const basic_regex& e, @@ -162,42 +106,6 @@ inline bool regex_search(const std::basic_string& s, { return regex_search(s.begin(), s.end(), e, flags); } -#else // non-template function overloads -inline bool regex_search(const char* str, - const regex& e, - match_flag_type flags = match_default) -{ - cmatch m; - return regex_search(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#ifndef BOOST_NO_WREGEX -inline bool regex_search(const wchar_t* str, - const wregex& e, - match_flag_type flags = match_default) -{ - wcmatch m; - return regex_search(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any); -} -#endif -inline bool regex_search(const std::string& s, - const regex& e, - match_flag_type flags = match_default) -{ - smatch m; - return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} -#if !defined(BOOST_NO_WREGEX) -inline bool regex_search(const std::basic_string& s, - const wregex& e, - match_flag_type flags = match_default) -{ - wsmatch m; - return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any); -} - -#endif // BOOST_NO_WREGEX - -#endif // partial overload #ifdef BOOST_MSVC #pragma warning(push) diff --git a/include/boost/regex/v5/regex_token_iterator.hpp b/include/boost/regex/v5/regex_token_iterator.hpp index 77a71201..ff97ca7d 100644 --- a/include/boost/regex/v5/regex_token_iterator.hpp +++ b/include/boost/regex/v5/regex_token_iterator.hpp @@ -58,23 +58,6 @@ public: : end(last), re(*p), flags(f), N(0){ subs.push_back(sub); } regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector& v, match_flag_type f) : end(last), re(*p), flags(f), N(0), subs(v){} -#if !BOOST_WORKAROUND(__HP_aCC, < 60700) -#if (BOOST_WORKAROUND(BOOST_BORLANDC, >= 0x560) && BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ - || BOOST_WORKAROUND(__HP_aCC, < 60700) - template - regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f) - : end(last), re(*p), flags(f), N(0) - { - // assert that T really is an array: - BOOST_STATIC_ASSERT(::boost::is_array::value); - const std::size_t array_size = sizeof(T) / sizeof(submatches[0]); - for(std::size_t i = 0; i < array_size; ++i) - { - subs.push_back(submatches[i]); - } - } -#else template regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f) : end(last), re(*p), flags(f), N(0) @@ -84,8 +67,6 @@ public: subs.push_back(submatches[i]); } } -#endif -#endif bool init(BidirectionalIterator first) { N = 0; @@ -152,7 +133,7 @@ private: }; template ::value_type, + class charT = typename std::iterator_traits::value_type, class traits = regex_traits > class regex_token_iterator { @@ -162,7 +143,7 @@ private: public: typedef basic_regex regex_type; typedef sub_match value_type; - typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::difference_type + typedef typename std::iterator_traits::difference_type difference_type; typedef const value_type* pointer; typedef const value_type& reference; @@ -183,19 +164,6 @@ public: if(!pdata->init(a)) pdata.reset(); } -#if !BOOST_WORKAROUND(__HP_aCC, < 60700) -#if (BOOST_WORKAROUND(BOOST_BORLANDC, >= 0x560) && BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ - || BOOST_WORKAROUND(__HP_aCC, < 60700) - template - regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, - const T& submatches, match_flag_type m = match_default) - : pdata(new impl(&re, b, submatches, m)) - { - if(!pdata->init(a)) - pdata.reset(); - } -#else template regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const int (&submatches)[N], match_flag_type m = match_default) @@ -204,8 +172,6 @@ public: if(!pdata->init(a)) pdata.reset(); } -#endif -#endif regex_token_iterator(const regex_token_iterator& that) : pdata(that.pdata) {} regex_token_iterator& operator=(const regex_token_iterator& that) diff --git a/include/boost/regex/v5/regex_traits.hpp b/include/boost/regex/v5/regex_traits.hpp index e4b1279b..8b1d5f84 100644 --- a/include/boost/regex/v5/regex_traits.hpp +++ b/include/boost/regex/v5/regex_traits.hpp @@ -19,39 +19,17 @@ #ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED #define BOOST_REGEX_TRAITS_HPP_INCLUDED -#ifndef BOOST_REGEX_CONFIG_HPP #include -#endif -#ifndef BOOST_REGEX_WORKAROUND_HPP #include -#endif -#ifndef BOOST_REGEX_SYNTAX_TYPE_HPP #include -#endif -#ifndef BOOST_REGEX_ERROR_TYPE_HPP #include -#endif -#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED #include -#endif -#ifndef BOOST_NO_STD_LOCALE -# ifndef BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED -# include -# endif -#endif -#if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x560) -# ifndef BOOST_C_REGEX_TRAITS_HPP_INCLUDED -# include -# endif -#endif +#include +#include #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32) -# ifndef BOOST_W32_REGEX_TRAITS_HPP_INCLUDED # include -# endif #endif -#ifndef BOOST_REGEX_FWD_HPP_INCLUDED #include -#endif #ifdef BOOST_MSVC #pragma warning(push) @@ -136,26 +114,11 @@ struct compute_wrapper_base { typedef BaseT type; }; -#if !BOOST_WORKAROUND(__HP_aCC, < 60000) template struct compute_wrapper_base { typedef default_wrapper type; }; -#else -template <> -struct compute_wrapper_base, false> -{ - typedef default_wrapper > type; -}; -#ifndef BOOST_NO_WREGEX -template <> -struct compute_wrapper_base, false> -{ - typedef default_wrapper > type; -}; -#endif -#endif } // namespace BOOST_REGEX_DETAIL_NS diff --git a/include/boost/regex/v5/regex_traits_defaults.hpp b/include/boost/regex/v5/regex_traits_defaults.hpp index c5f318b9..b2f859a9 100644 --- a/include/boost/regex/v5/regex_traits_defaults.hpp +++ b/include/boost/regex/v5/regex_traits_defaults.hpp @@ -32,14 +32,9 @@ #include -#ifndef BOOST_REGEX_SYNTAX_TYPE_HPP #include -#endif -#ifndef BOOST_REGEX_ERROR_TYPE_HPP #include -#endif #include -#include #include #include #include @@ -59,7 +54,7 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{ template inline bool is_extended(charT c) { - typedef typename make_unsigned::type unsigned_type; + typedef typename std::make_unsigned::type unsigned_type; return (sizeof(charT) > 1) && (static_cast(c) >= 256u); } inline bool is_extended(char) @@ -628,7 +623,6 @@ inline bool is_combining(unsigned char) { return false; } -#if !defined(__hpux) && !defined(__WINSCW__) // can't use WCHAR_MAX/MIN in pp-directives #ifdef _MSC_VER template<> inline bool is_combining(wchar_t c) @@ -650,7 +644,6 @@ inline bool is_combining(wchar_t c) } #endif #endif -#endif // // is a charT c a line separator? diff --git a/include/boost/regex/v5/sub_match.hpp b/include/boost/regex/v5/sub_match.hpp index db666126..29dc4dc5 100644 --- a/include/boost/regex/v5/sub_match.hpp +++ b/include/boost/regex/v5/sub_match.hpp @@ -35,12 +35,8 @@ namespace boost{ template struct sub_match : public std::pair { - typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type value_type; -#if defined(BOOST_NO_STD_ITERATOR_TRAITS) - typedef std::ptrdiff_t difference_type; -#else - typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::difference_type difference_type; -#endif + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type difference_type; typedef BidiIterator iterator_type; typedef BidiIterator iterator; typedef BidiIterator const_iterator; @@ -49,20 +45,11 @@ struct sub_match : public std::pair sub_match() : std::pair(), matched(false) {} sub_match(BidiIterator i) : std::pair(i, i), matched(false) {} -#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ - && !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0551)\ - && !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) template operator std::basic_string ()const { return matched ? std::basic_string(this->first, this->second) : std::basic_string(); } -#else - operator std::basic_string ()const - { - return str(); - } -#endif difference_type BOOST_REGEX_CALL length()const { difference_type n = matched ? std::distance((BidiIterator)this->first, (BidiIterator)this->second) : 0; @@ -167,23 +154,6 @@ public: // BidiIterator begin()const { return this->first; } BidiIterator end()const { return this->second; } - - -#ifdef BOOST_OLD_REGEX_H - // - // the following are deprecated, do not use!! - // - operator int()const; - operator unsigned int()const; - operator short()const - { - return (short)(int)(*this); - } - operator unsigned short()const - { - return (unsigned short)(unsigned int)(*this); - } -#endif }; typedef sub_match csub_match; @@ -195,239 +165,220 @@ typedef sub_match wssub_match; // comparison to std::basic_string<> part 1: template -inline bool operator == (const std::basic_string::value_type, traits, Allocator>& s, +inline bool operator == (const std::basic_string::value_type, traits, Allocator>& s, const sub_match& m) { return s.compare(m.str()) == 0; } template -inline bool operator != (const std::basic_string::value_type, traits, Allocator>& s, +inline bool operator != (const std::basic_string::value_type, traits, Allocator>& s, const sub_match& m) { return s.compare(m.str()) != 0; } template -inline bool operator < (const std::basic_string::value_type, traits, Allocator>& s, +inline bool operator < (const std::basic_string::value_type, traits, Allocator>& s, const sub_match& m) { return s.compare(m.str()) < 0; } template -inline bool operator <= (const std::basic_string::value_type, traits, Allocator>& s, +inline bool operator <= (const std::basic_string::value_type, traits, Allocator>& s, const sub_match& m) { return s.compare(m.str()) <= 0; } template -inline bool operator >= (const std::basic_string::value_type, traits, Allocator>& s, +inline bool operator >= (const std::basic_string::value_type, traits, Allocator>& s, const sub_match& m) { return s.compare(m.str()) >= 0; } template -inline bool operator > (const std::basic_string::value_type, traits, Allocator>& s, +inline bool operator > (const std::basic_string::value_type, traits, Allocator>& s, const sub_match& m) { return s.compare(m.str()) > 0; } // comparison to std::basic_string<> part 2: template inline bool operator == (const sub_match& m, - const std::basic_string::value_type, traits, Allocator>& s) + const std::basic_string::value_type, traits, Allocator>& s) { return m.str().compare(s) == 0; } template inline bool operator != (const sub_match& m, - const std::basic_string::value_type, traits, Allocator>& s) + const std::basic_string::value_type, traits, Allocator>& s) { return m.str().compare(s) != 0; } template inline bool operator < (const sub_match& m, - const std::basic_string::value_type, traits, Allocator>& s) + const std::basic_string::value_type, traits, Allocator>& s) { return m.str().compare(s) < 0; } template inline bool operator > (const sub_match& m, - const std::basic_string::value_type, traits, Allocator>& s) + const std::basic_string::value_type, traits, Allocator>& s) { return m.str().compare(s) > 0; } template inline bool operator <= (const sub_match& m, - const std::basic_string::value_type, traits, Allocator>& s) + const std::basic_string::value_type, traits, Allocator>& s) { return m.str().compare(s) <= 0; } template inline bool operator >= (const sub_match& m, - const std::basic_string::value_type, traits, Allocator>& s) + const std::basic_string::value_type, traits, Allocator>& s) { return m.str().compare(s) >= 0; } // comparison to const charT* part 1: template inline bool operator == (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s) + typename std::iterator_traits::value_type const* s) { return m.str().compare(s) == 0; } template inline bool operator != (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s) + typename std::iterator_traits::value_type const* s) { return m.str().compare(s) != 0; } template inline bool operator > (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s) + typename std::iterator_traits::value_type const* s) { return m.str().compare(s) > 0; } template inline bool operator < (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s) + typename std::iterator_traits::value_type const* s) { return m.str().compare(s) < 0; } template inline bool operator >= (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s) + typename std::iterator_traits::value_type const* s) { return m.str().compare(s) >= 0; } template inline bool operator <= (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s) + typename std::iterator_traits::value_type const* s) { return m.str().compare(s) <= 0; } // comparison to const charT* part 2: template -inline bool operator == (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s, +inline bool operator == (typename std::iterator_traits::value_type const* s, const sub_match& m) { return m.str().compare(s) == 0; } template -inline bool operator != (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s, +inline bool operator != (typename std::iterator_traits::value_type const* s, const sub_match& m) { return m.str().compare(s) != 0; } template -inline bool operator < (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s, +inline bool operator < (typename std::iterator_traits::value_type const* s, const sub_match& m) { return m.str().compare(s) > 0; } template -inline bool operator > (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s, +inline bool operator > (typename std::iterator_traits::value_type const* s, const sub_match& m) { return m.str().compare(s) < 0; } template -inline bool operator <= (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s, +inline bool operator <= (typename std::iterator_traits::value_type const* s, const sub_match& m) { return m.str().compare(s) >= 0; } template -inline bool operator >= (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s, +inline bool operator >= (typename std::iterator_traits::value_type const* s, const sub_match& m) { return m.str().compare(s) <= 0; } // comparison to const charT& part 1: template inline bool operator == (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s) + typename std::iterator_traits::value_type const& s) { return m.str().compare(0, m.length(), &s, 1) == 0; } template inline bool operator != (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s) + typename std::iterator_traits::value_type const& s) { return m.str().compare(0, m.length(), &s, 1) != 0; } template inline bool operator > (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s) + typename std::iterator_traits::value_type const& s) { return m.str().compare(0, m.length(), &s, 1) > 0; } template inline bool operator < (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s) + typename std::iterator_traits::value_type const& s) { return m.str().compare(0, m.length(), &s, 1) < 0; } template inline bool operator >= (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s) + typename std::iterator_traits::value_type const& s) { return m.str().compare(0, m.length(), &s, 1) >= 0; } template inline bool operator <= (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s) + typename std::iterator_traits::value_type const& s) { return m.str().compare(0, m.length(), &s, 1) <= 0; } // comparison to const charT* part 2: template -inline bool operator == (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s, +inline bool operator == (typename std::iterator_traits::value_type const& s, const sub_match& m) { return m.str().compare(0, m.length(), &s, 1) == 0; } template -inline bool operator != (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s, +inline bool operator != (typename std::iterator_traits::value_type const& s, const sub_match& m) { return m.str().compare(0, m.length(), &s, 1) != 0; } template -inline bool operator < (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s, +inline bool operator < (typename std::iterator_traits::value_type const& s, const sub_match& m) { return m.str().compare(0, m.length(), &s, 1) > 0; } template -inline bool operator > (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s, +inline bool operator > (typename std::iterator_traits::value_type const& s, const sub_match& m) { return m.str().compare(0, m.length(), &s, 1) < 0; } template -inline bool operator <= (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s, +inline bool operator <= (typename std::iterator_traits::value_type const& s, const sub_match& m) { return m.str().compare(0, m.length(), &s, 1) >= 0; } template -inline bool operator >= (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s, +inline bool operator >= (typename std::iterator_traits::value_type const& s, const sub_match& m) { return m.str().compare(0, m.length(), &s, 1) <= 0; } // addition operators: template -inline std::basic_string::value_type, traits, Allocator> -operator + (const std::basic_string::value_type, traits, Allocator>& s, +inline std::basic_string::value_type, traits, Allocator> +operator + (const std::basic_string::value_type, traits, Allocator>& s, const sub_match& m) { - std::basic_string::value_type, traits, Allocator> result; + std::basic_string::value_type, traits, Allocator> result; result.reserve(s.size() + m.length() + 1); return result.append(s).append(m.first, m.second); } template -inline std::basic_string::value_type, traits, Allocator> +inline std::basic_string::value_type, traits, Allocator> operator + (const sub_match& m, - const std::basic_string::value_type, traits, Allocator>& s) + const std::basic_string::value_type, traits, Allocator>& s) { - std::basic_string::value_type, traits, Allocator> result; + std::basic_string::value_type, traits, Allocator> result; result.reserve(s.size() + m.length() + 1); return result.append(m.first, m.second).append(s); } -#if !(defined(__GNUC__) && defined(BOOST_NO_STD_LOCALE)) template -inline std::basic_string::value_type> -operator + (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s, +inline std::basic_string::value_type> +operator + (typename std::iterator_traits::value_type const* s, const sub_match& m) { - std::basic_string::value_type> result; - result.reserve(std::char_traits::value_type>::length(s) + m.length() + 1); + std::basic_string::value_type> result; + result.reserve(std::char_traits::value_type>::length(s) + m.length() + 1); return result.append(s).append(m.first, m.second); } template -inline std::basic_string::value_type> +inline std::basic_string::value_type> operator + (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const * s) + typename std::iterator_traits::value_type const * s) { - std::basic_string::value_type> result; - result.reserve(std::char_traits::value_type>::length(s) + m.length() + 1); + std::basic_string::value_type> result; + result.reserve(std::char_traits::value_type>::length(s) + m.length() + 1); return result.append(m.first, m.second).append(s); } -#else -// worwaround versions: template -inline std::basic_string::value_type> -operator + (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const* s, +inline std::basic_string::value_type> +operator + (typename std::iterator_traits::value_type const& s, const sub_match& m) { - return s + m.str(); -} -template -inline std::basic_string::value_type> -operator + (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const * s) -{ - return m.str() + s; -} -#endif -template -inline std::basic_string::value_type> -operator + (typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s, - const sub_match& m) -{ - std::basic_string::value_type> result; + std::basic_string::value_type> result; result.reserve(m.length() + 2); return result.append(1, s).append(m.first, m.second); } template -inline std::basic_string::value_type> +inline std::basic_string::value_type> operator + (const sub_match& m, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::value_type const& s) + typename std::iterator_traits::value_type const& s) { - std::basic_string::value_type> result; + std::basic_string::value_type> result; result.reserve(m.length() + 2); return result.append(m.first, m.second).append(1, s); } template -inline std::basic_string::value_type> +inline std::basic_string::value_type> operator + (const sub_match& m1, const sub_match& m2) { - std::basic_string::value_type> result; + std::basic_string::value_type> result; result.reserve(m1.length() + m2.length() + 1); return result.append(m1.first, m1.second).append(m2.first, m2.second); } -#ifndef BOOST_NO_STD_LOCALE template std::basic_ostream& operator << (std::basic_ostream& os, @@ -435,69 +386,6 @@ std::basic_ostream& { return (os << s.str()); } -#else -template -std::ostream& operator << (std::ostream& os, - const sub_match& s) -{ - return (os << s.str()); -} -#endif - -#ifdef BOOST_OLD_REGEX_H -namespace BOOST_REGEX_DETAIL_NS{ -template -int do_toi(BidiIterator i, BidiIterator j, char c, int radix) -{ - std::string s(i, j); - char* p; - int result = std::strtol(s.c_str(), &p, radix); - if(*p)raise_regex_exception("Bad sub-expression"); - return result; -} - -// -// helper: -template -int do_toi(I& i, I j, charT c) -{ - int result = 0; - while((i != j) && (isdigit(*i))) - { - result = result*10 + (*i - '0'); - ++i; - } - return result; -} -} - - -template -sub_match::operator int()const -{ - BidiIterator i = first; - BidiIterator j = second; - if(i == j)raise_regex_exception("Bad sub-expression"); - int neg = 1; - if((i != j) && (*i == '-')) - { - neg = -1; - ++i; - } - neg *= BOOST_REGEX_DETAIL_NS::do_toi(i, j, *i); - if(i != j)raise_regex_exception("Bad sub-expression"); - return neg; -} -template -sub_match::operator unsigned int()const -{ - BidiIterator i = first; - BidiIterator j = second; - if(i == j) - raise_regex_exception("Bad sub-expression"); - return BOOST_REGEX_DETAIL_NS::do_toi(i, j, *first); -} -#endif } // namespace boost diff --git a/include/boost/regex/v5/u32regex_iterator.hpp b/include/boost/regex/v5/u32regex_iterator.hpp index 37448c1f..f47fca74 100644 --- a/include/boost/regex/v5/u32regex_iterator.hpp +++ b/include/boost/regex/v5/u32regex_iterator.hpp @@ -79,7 +79,7 @@ private: public: typedef u32regex regex_type; typedef match_results value_type; - typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::difference_type + typedef typename std::iterator_traits::difference_type difference_type; typedef const value_type* pointer; typedef const value_type& reference; diff --git a/include/boost/regex/v5/u32regex_token_iterator.hpp b/include/boost/regex/v5/u32regex_token_iterator.hpp index ede7a76e..137afa64 100644 --- a/include/boost/regex/v5/u32regex_token_iterator.hpp +++ b/include/boost/regex/v5/u32regex_token_iterator.hpp @@ -49,22 +49,6 @@ public: : end(last), re(*p), flags(f){ subs.push_back(sub); } u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector& v, match_flag_type f) : end(last), re(*p), flags(f), subs(v){} -#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ - || BOOST_WORKAROUND(__HP_aCC, < 60700) - template - u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f) - : end(last), re(*p), flags(f) - { - // assert that T really is an array: - BOOST_STATIC_ASSERT(::boost::is_array::value); - const std::size_t array_size = sizeof(T) / sizeof(submatches[0]); - for(std::size_t i = 0; i < array_size; ++i) - { - subs.push_back(submatches[i]); - } - } -#else template u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f) : end(last), re(*p), flags(f) @@ -74,7 +58,6 @@ public: subs.push_back(submatches[i]); } } -#endif bool init(BidirectionalIterator first) { @@ -150,7 +133,7 @@ private: public: typedef u32regex regex_type; typedef sub_match value_type; - typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::difference_type + typedef typename std::iterator_traits::difference_type difference_type; typedef const value_type* pointer; typedef const value_type& reference; @@ -171,18 +154,6 @@ public: if(!pdata->init(a)) pdata.reset(); } -#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ - || BOOST_WORKAROUND(__HP_aCC, < 60700) - template - u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, - const T& submatches, match_flag_type m = match_default) - : pdata(new impl(&re, b, submatches, m)) - { - if(!pdata->init(a)) - pdata.reset(); - } -#else template u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const int (&submatches)[N], match_flag_type m = match_default) @@ -191,7 +162,6 @@ public: if(!pdata->init(a)) pdata.reset(); } -#endif u32regex_token_iterator(const u32regex_token_iterator& that) : pdata(that.pdata) {} u32regex_token_iterator& operator=(const u32regex_token_iterator& that) diff --git a/include/boost/regex/v5/w32_regex_traits.hpp b/include/boost/regex/v5/w32_regex_traits.hpp index 46e26660..d1dee7f4 100644 --- a/include/boost/regex/v5/w32_regex_traits.hpp +++ b/include/boost/regex/v5/w32_regex_traits.hpp @@ -21,21 +21,13 @@ #ifndef BOOST_REGEX_NO_WIN32_LOCALE -#ifndef BOOST_RE_PAT_EXCEPT_HPP #include -#endif -#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED #include -#endif #ifdef BOOST_HAS_THREADS #include #endif -#ifndef BOOST_REGEX_PRIMARY_TRANSFORM #include -#endif -#ifndef BOOST_REGEX_OBJECT_CACHE_HPP #include -#endif #include @@ -391,32 +383,10 @@ typename w32_regex_traits_implementation::string_type if(pos != m_custom_collate_names.end()) return pos->second; } -#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ - && !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0551) std::string name(p1, p2); -#else - std::string name; - const charT* p0 = p1; - while(p0 != p2) - name.append(1, char(*p0++)); -#endif name = lookup_default_collate_name(name); -#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ - && !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0551) if(name.size()) return string_type(name.begin(), name.end()); -#else - if(name.size()) - { - string_type result; - typedef std::string::const_iterator iter; - iter b = name.begin(); - iter e = name.end(); - while(b != e) - result.append(1, charT(*b++)); - return result; - } -#endif if(p2 - p1 == 1) return string_type(1, *p1); return string_type();