From c2db73aec7583dcae31ee91cf6e6e8517d76d0ac Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 17 Jan 2005 12:10:48 +0000 Subject: [PATCH] Cleaned up non-standard behaviour in traits classes. Suppressed explicit instantiations for older Intel versions. Added std::distance workaround for Sunpro. [SVN r26716] --- include/boost/regex/v4/cpp_regex_traits.hpp | 58 ++++++--------------- include/boost/regex/v4/instances.hpp | 2 +- include/boost/regex/v4/regex_format.hpp | 8 +-- include/boost/regex/v4/w32_regex_traits.hpp | 2 - 4 files changed, 22 insertions(+), 48 deletions(-) diff --git a/include/boost/regex/v4/cpp_regex_traits.hpp b/include/boost/regex/v4/cpp_regex_traits.hpp index 40e57ab8..8c0cb911 100644 --- a/include/boost/regex/v4/cpp_regex_traits.hpp +++ b/include/boost/regex/v4/cpp_regex_traits.hpp @@ -393,39 +393,7 @@ public: BOOST_STATIC_CONSTANT(char_class_type, mask_blank = 1u << 16); BOOST_STATIC_CONSTANT(char_class_type, mask_word = 1u << 17); BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 1u << 18); -#ifdef __GNUC__ - BOOST_STATIC_CONSTANT(native_mask_type, - mask_base = - static_cast( - std::ctype::alnum - | std::ctype::alpha - | std::ctype::cntrl - | std::ctype::digit - | std::ctype::graph - | std::ctype::lower - | std::ctype::print - | std::ctype::punct - | std::ctype::space - | std::ctype::upper - | std::ctype::xdigit)); -#else - BOOST_STATIC_CONSTANT(char_class_type, - mask_base = - std::ctype::alnum - | std::ctype::alpha - | std::ctype::cntrl - | std::ctype::digit - | std::ctype::graph - | std::ctype::lower - | std::ctype::print - | std::ctype::punct - | std::ctype::space - | std::ctype::upper - | std::ctype::xdigit); #endif -#endif - //BOOST_STATIC_ASSERT(0 == (mask_base & (mask_word | mask_unicode))); - typedef std::basic_string string_type; typedef charT char_type; @@ -491,13 +459,6 @@ template typename cpp_regex_traits_implementation::char_class_type const cpp_regex_traits_implementation::mask_word; template typename cpp_regex_traits_implementation::char_class_type const cpp_regex_traits_implementation::mask_unicode; -#ifdef __GNUC__ -template -typename cpp_regex_traits_implementation::native_mask_type const cpp_regex_traits_implementation::mask_base; -#else -template -typename cpp_regex_traits_implementation::char_class_type const cpp_regex_traits_implementation::mask_base; -#endif #endif #endif @@ -919,9 +880,24 @@ public: { #ifndef BOOST_REGEX_BUGGY_CTYPE_FACET typedef typename std::ctype::mask ctype_mask; - if((f & re_detail::cpp_regex_traits_implementation::mask_base) + + static const ctype_mask mask_base = + static_cast( + std::ctype::alnum + | std::ctype::alpha + | std::ctype::cntrl + | std::ctype::digit + | std::ctype::graph + | std::ctype::lower + | std::ctype::print + | std::ctype::punct + | std::ctype::space + | std::ctype::upper + | std::ctype::xdigit); + + if((f & mask_base) && (m_pimpl->m_pctype->is( - static_cast(f & re_detail::cpp_regex_traits_implementation::mask_base), c))) + static_cast(f & mask_base), c))) return true; else if((f & re_detail::cpp_regex_traits_implementation::mask_unicode) && re_detail::is_extended(c)) return true; diff --git a/include/boost/regex/v4/instances.hpp b/include/boost/regex/v4/instances.hpp index 862b69c4..6569097f 100644 --- a/include/boost/regex/v4/instances.hpp +++ b/include/boost/regex/v4/instances.hpp @@ -79,7 +79,7 @@ template class BOOST_REGEX_DECL match_results< const BOOST_REGEX_CHAR_T* >; #ifndef BOOST_NO_STD_ALLOCATOR template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher::allocator_type, boost::regex_traits >; #endif -#if !(defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB <= 1)) +#if !(defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB <= 1)) && !(defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION <= 800)) #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) template class BOOST_REGEX_DECL match_results< std::basic_string::const_iterator >; #endif diff --git a/include/boost/regex/v4/regex_format.hpp b/include/boost/regex/v4/regex_format.hpp index d6f1ed82..40b45afc 100644 --- a/include/boost/regex/v4/regex_format.hpp +++ b/include/boost/regex/v4/regex_format.hpp @@ -243,7 +243,7 @@ void basic_regex_formatter::format_perl() default: // see if we have a number: { - std::ptrdiff_t len = (std::min)(static_cast(2), std::distance(m_position, m_end)); + std::ptrdiff_t len = (std::min)(static_cast(2), ::boost::re_detail::distance(m_position, m_end)); int v = m_traits.toi(m_position, m_position + len, 10); if(v < 0) { @@ -327,7 +327,7 @@ void basic_regex_formatter::format_escape() } else { - std::ptrdiff_t len = (std::min)(static_cast(2), std::distance(m_position, m_end)); + std::ptrdiff_t len = (std::min)(static_cast(2), ::boost::re_detail::distance(m_position, m_end)); int val = m_traits.toi(m_position, m_position + len, 16); if(val < 0) { @@ -398,7 +398,7 @@ void basic_regex_formatter::format_escape() { // octal ecape sequence: --m_position; - std::ptrdiff_t len = (std::min)(static_cast(4), std::distance(m_position, m_end)); + std::ptrdiff_t len = (std::min)(static_cast(4), ::boost::re_detail::distance(m_position, m_end)); v = m_traits.toi(m_position, m_position + len, 8); BOOST_ASSERT(v >= 0); put(static_cast(v)); @@ -419,7 +419,7 @@ void basic_regex_formatter::format_conditional( put(static_cast('?')); return; } - std::ptrdiff_t len = (std::min)(static_cast(2), std::distance(m_position, m_end)); + std::ptrdiff_t len = (std::min)(static_cast(2), ::boost::re_detail::distance(m_position, m_end)); int v = m_traits.toi(m_position, m_position + len, 10); if(v < 0) { diff --git a/include/boost/regex/v4/w32_regex_traits.hpp b/include/boost/regex/v4/w32_regex_traits.hpp index 16614f98..8a3049b7 100644 --- a/include/boost/regex/v4/w32_regex_traits.hpp +++ b/include/boost/regex/v4/w32_regex_traits.hpp @@ -548,8 +548,6 @@ boost::shared_ptr > create_w32_regex_trai template class w32_regex_traits { -private: - typedef std::ctype ctype_type; public: typedef charT char_type; typedef std::size_t size_type;