forked from boostorg/regex
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
c82a797230 | |||
260982ea9e | |||
6efa868bfa | |||
b1301061e5 | |||
6b78d0af7f | |||
ecd5c207cf | |||
4ca037c559 | |||
57ccc945bd |
@ -76,13 +76,10 @@ inline long hash_value(char_architype val)
|
||||
//
|
||||
} // namespace boost
|
||||
namespace std{
|
||||
template<> struct char_traits<boost::char_architype>
|
||||
{
|
||||
// The intent is that this template is not instantiated,
|
||||
// but this typedef gives us a chance of compilation in
|
||||
// case it is:
|
||||
typedef boost::char_architype char_type;
|
||||
};
|
||||
//
|
||||
// We should never use this, if we do it should be an error:
|
||||
//
|
||||
template<> struct char_traits<boost::char_architype>;
|
||||
}
|
||||
//
|
||||
// Allocator architype:
|
||||
@ -412,6 +409,10 @@ struct BaseRegexConcept
|
||||
Regex e5(in1, in2, m_flags);
|
||||
ignore_unused_variable_warning(e5);
|
||||
|
||||
// equals:
|
||||
e1 == e2;
|
||||
e1 != e2;
|
||||
|
||||
// assign etc:
|
||||
Regex e;
|
||||
e = m_pointer;
|
||||
|
@ -488,7 +488,7 @@ public:
|
||||
}
|
||||
//
|
||||
// swap:
|
||||
void swap(basic_regex& that)throw()
|
||||
void swap(basic_regex& that)noexcept
|
||||
{
|
||||
m_pimpl.swap(that.m_pimpl);
|
||||
}
|
||||
@ -533,7 +533,21 @@ public:
|
||||
return status() - that.status();
|
||||
if(flags() != that.flags())
|
||||
return flags() - that.flags();
|
||||
return str().compare(that.str());
|
||||
|
||||
const char_type* i = m_pimpl->begin();
|
||||
const char_type* j = that.m_pimpl->begin();
|
||||
while ((i != m_pimpl->end()) && (j != that.m_pimpl->end()))
|
||||
{
|
||||
if (*i != *j)
|
||||
return *i < *j ? -1 : 1;
|
||||
++i;
|
||||
++j;
|
||||
}
|
||||
if (i != m_pimpl->end())
|
||||
return *i > static_cast<char_type>(0) ? 1 : -1;
|
||||
if (j != that.m_pimpl->end())
|
||||
return *j > static_cast<char_type>(0) ? -1 : 1;
|
||||
return 0;
|
||||
}
|
||||
bool operator==(const basic_regex& e)const
|
||||
{
|
||||
|
@ -97,15 +97,23 @@ public:
|
||||
bool empty() const
|
||||
{ return m_subs.size() < 2; }
|
||||
// element access:
|
||||
difference_type length(int sub = 0) const
|
||||
private:
|
||||
difference_type do_get_length(int sub = 0) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
if (m_is_singular)
|
||||
raise_logic_error();
|
||||
sub += 2;
|
||||
if((sub < (int)m_subs.size()) && (sub > 0))
|
||||
if ((sub < (int)m_subs.size()) && (sub > 0))
|
||||
return m_subs[sub].length();
|
||||
return 0;
|
||||
}
|
||||
public:
|
||||
template <class Integer>
|
||||
typename std::enable_if<std::is_integral<Integer>::value, difference_type>::type length(Integer sub) const
|
||||
{
|
||||
return do_get_length(static_cast<int>(sub));
|
||||
}
|
||||
difference_type length() const { return do_get_length(0); }
|
||||
difference_type length(const char_type* sub) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
@ -161,7 +169,8 @@ public:
|
||||
{
|
||||
return position(sub.c_str());
|
||||
}
|
||||
string_type str(int sub = 0) const
|
||||
private:
|
||||
string_type do_get_string(int sub = 0) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
@ -177,6 +186,13 @@ public:
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public:
|
||||
template <class Integer>
|
||||
typename std::enable_if<std::is_integral<Integer>::value, string_type>::type str(Integer sub) const
|
||||
{
|
||||
return do_get_string(static_cast<int>(sub));
|
||||
}
|
||||
string_type str() const { return do_get_string(0); }
|
||||
string_type str(const char_type* sub) const
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
@ -196,7 +212,8 @@ public:
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
}
|
||||
const_reference operator[](int sub) const
|
||||
private:
|
||||
const_reference get_at(int sub) const
|
||||
{
|
||||
if(m_is_singular && m_subs.empty())
|
||||
raise_logic_error();
|
||||
@ -207,6 +224,12 @@ public:
|
||||
}
|
||||
return m_null;
|
||||
}
|
||||
public:
|
||||
template <class Integer>
|
||||
typename std::enable_if<std::is_integral<Integer>::value, const_reference>::type operator[](Integer sub) const
|
||||
{
|
||||
return get_at(static_cast<int>(sub));
|
||||
}
|
||||
//
|
||||
// Named sub-expressions:
|
||||
//
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
, m_position(0)
|
||||
{
|
||||
}
|
||||
~regex_error() noexcept override {}
|
||||
~regex_error() noexcept override = default;
|
||||
regex_constants::error_type code()const
|
||||
{ return m_error_code; }
|
||||
std::ptrdiff_t position()const
|
||||
|
Reference in New Issue
Block a user