mirror of
https://github.com/boostorg/regex.git
synced 2025-07-29 12:07:28 +02:00
merged changes in regex5 branch
[SVN r26692]
This commit is contained in:
@ -42,20 +42,29 @@ struct sub_match : public std::pair<BidiIterator, BidiIterator>
|
||||
|
||||
sub_match() : std::pair<BidiIterator, BidiIterator>(), matched(false) {}
|
||||
sub_match(BidiIterator i) : std::pair<BidiIterator, BidiIterator>(i, i), matched(false) {}
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
|
||||
&& !BOOST_WORKAROUND(BOOST_MSVC, < 1310)\
|
||||
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
|
||||
template <class T, class A>
|
||||
operator std::basic_string<value_type, T, A> ()const
|
||||
{
|
||||
return std::basic_string<value_type, T, A>(this->first, this->second);
|
||||
}
|
||||
#else
|
||||
operator std::basic_string<value_type> ()const
|
||||
{
|
||||
return str();
|
||||
}
|
||||
#endif
|
||||
difference_type BOOST_REGEX_CALL length()const
|
||||
{
|
||||
difference_type n = boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second);
|
||||
difference_type n = ::boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second);
|
||||
return n;
|
||||
}
|
||||
std::basic_string<value_type> str()const
|
||||
{
|
||||
std::basic_string<value_type> result;
|
||||
std::size_t len = boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second);
|
||||
std::size_t len = ::boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second);
|
||||
result.reserve(len);
|
||||
BidiIterator i = this->first;
|
||||
while(i != this->second)
|
||||
@ -71,6 +80,14 @@ struct sub_match : public std::pair<BidiIterator, BidiIterator>
|
||||
return static_cast<int>(matched) - static_cast<int>(s.matched);
|
||||
return str().compare(s.str());
|
||||
}
|
||||
int compare(const std::basic_string<value_type>& s)const
|
||||
{
|
||||
return str().compare(s);
|
||||
}
|
||||
int compare(const value_type* p)const
|
||||
{
|
||||
return str().compare(p);
|
||||
}
|
||||
|
||||
bool operator==(const sub_match& that)const
|
||||
{ return compare(that) == 0; }
|
||||
@ -154,6 +171,13 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef sub_match<const char*> csub_match;
|
||||
typedef sub_match<std::string::const_iterator> ssub_match;
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
typedef sub_match<const wchar_t*> wcsub_match;
|
||||
typedef sub_match<std::wstring::const_iterator> wssub_match;
|
||||
#endif
|
||||
|
||||
// comparison to std::basic_string<> part 1:
|
||||
template <class RandomAccessIterator, class traits, class Allocator>
|
||||
inline bool operator == (const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
|
||||
|
Reference in New Issue
Block a user