Cleaned up non-standard behaviour in traits classes.

Suppressed explicit instantiations for older Intel versions.
Added std::distance workaround for Sunpro.


[SVN r26716]
This commit is contained in:
John Maddock
2005-01-17 12:10:48 +00:00
parent 30acb7d2f8
commit c2db73aec7
4 changed files with 22 additions and 48 deletions

View File

@ -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<native_mask_type>(
std::ctype<charT>::alnum
| std::ctype<charT>::alpha
| std::ctype<charT>::cntrl
| std::ctype<charT>::digit
| std::ctype<charT>::graph
| std::ctype<charT>::lower
| std::ctype<charT>::print
| std::ctype<charT>::punct
| std::ctype<charT>::space
| std::ctype<charT>::upper
| std::ctype<charT>::xdigit));
#else
BOOST_STATIC_CONSTANT(char_class_type,
mask_base =
std::ctype<charT>::alnum
| std::ctype<charT>::alpha
| std::ctype<charT>::cntrl
| std::ctype<charT>::digit
| std::ctype<charT>::graph
| std::ctype<charT>::lower
| std::ctype<charT>::print
| std::ctype<charT>::punct
| std::ctype<charT>::space
| std::ctype<charT>::upper
| std::ctype<charT>::xdigit);
#endif
#endif
//BOOST_STATIC_ASSERT(0 == (mask_base & (mask_word | mask_unicode)));
typedef std::basic_string<charT> string_type;
typedef charT char_type;
@ -491,13 +459,6 @@ template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_word;
template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_unicode;
#ifdef __GNUC__
template <class charT>
typename cpp_regex_traits_implementation<charT>::native_mask_type const cpp_regex_traits_implementation<charT>::mask_base;
#else
template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_base;
#endif
#endif
#endif
@ -919,9 +880,24 @@ public:
{
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
typedef typename std::ctype<charT>::mask ctype_mask;
if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_base)
static const ctype_mask mask_base =
static_cast<ctype_mask>(
std::ctype<charT>::alnum
| std::ctype<charT>::alpha
| std::ctype<charT>::cntrl
| std::ctype<charT>::digit
| std::ctype<charT>::graph
| std::ctype<charT>::lower
| std::ctype<charT>::print
| std::ctype<charT>::punct
| std::ctype<charT>::space
| std::ctype<charT>::upper
| std::ctype<charT>::xdigit);
if((f & mask_base)
&& (m_pimpl->m_pctype->is(
static_cast<ctype_mask>(f & re_detail::cpp_regex_traits_implementation<charT>::mask_base), c)))
static_cast<ctype_mask>(f & mask_base), c)))
return true;
else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_unicode) && re_detail::is_extended(c))
return true;

View File

@ -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<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >;
#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<BOOST_REGEX_CHAR_T>::const_iterator >;
#endif

View File

@ -243,7 +243,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
default:
// see if we have a number:
{
std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), std::distance(m_position, m_end));
std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(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<OutputIterator, Results, traits>::format_escape()
}
else
{
std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), std::distance(m_position, m_end));
std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(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<OutputIterator, Results, traits>::format_escape()
{
// octal ecape sequence:
--m_position;
std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(4), std::distance(m_position, m_end));
std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(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<char_type>(v));
@ -419,7 +419,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional(
put(static_cast<char_type>('?'));
return;
}
std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), std::distance(m_position, m_end));
std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), ::boost::re_detail::distance(m_position, m_end));
int v = m_traits.toi(m_position, m_position + len, 10);
if(v < 0)
{

View File

@ -548,8 +548,6 @@ boost::shared_ptr<w32_regex_traits_implementation<charT> > create_w32_regex_trai
template <class charT>
class w32_regex_traits
{
private:
typedef std::ctype<charT> ctype_type;
public:
typedef charT char_type;
typedef std::size_t size_type;