Skip to content

Initialize m_null and m_base #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 7 additions & 33 deletions include/boost/regex/v4/match_results.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,30 +76,20 @@ class match_results
// construct/copy/destroy:
explicit match_results(const Allocator& a = Allocator())
#ifndef BOOST_NO_STD_ALLOCATOR
: m_subs(a), m_base(), m_last_closed_paren(0), m_is_singular(true) {}
: m_subs(a), m_base(), m_null(), m_last_closed_paren(0), m_is_singular(true) {}
#else
: m_subs(), m_base(), m_last_closed_paren(0), m_is_singular(true) { (void)a; }
: m_subs(), m_base(), m_null(), m_last_closed_paren(0), m_is_singular(true) { (void)a; }
#endif
match_results(const match_results& m)
: m_subs(m.m_subs), m_named_subs(m.m_named_subs), m_last_closed_paren(m.m_last_closed_paren), m_is_singular(m.m_is_singular)
{
if(!m_is_singular)
{
m_base = m.m_base;
m_null = m.m_null;
}
}
: m_subs(m.m_subs), m_base(m.m_base), m_null(m.m_null), m_named_subs(m.m_named_subs), m_last_closed_paren(m.m_last_closed_paren), m_is_singular(m.m_is_singular) {}
match_results& operator=(const match_results& m)
{
m_subs = m.m_subs;
m_named_subs = m.m_named_subs;
m_last_closed_paren = m.m_last_closed_paren;
m_is_singular = m.m_is_singular;
if(!m_is_singular)
{
m_base = m.m_base;
m_null = m.m_null;
}
m_base = m.m_base;
m_null = m.m_null;
return *this;
}
~match_results(){}
Expand Down Expand Up @@ -410,24 +400,8 @@ class match_results
std::swap(m_subs, that.m_subs);
std::swap(m_named_subs, that.m_named_subs);
std::swap(m_last_closed_paren, that.m_last_closed_paren);
if(m_is_singular)
{
if(!that.m_is_singular)
{
m_base = that.m_base;
m_null = that.m_null;
}
}
else if(that.m_is_singular)
{
that.m_base = m_base;
that.m_null = m_null;
}
else
{
std::swap(m_base, that.m_base);
std::swap(m_null, that.m_null);
}
std::swap(m_base, that.m_base);
std::swap(m_null, that.m_null);
std::swap(m_is_singular, that.m_is_singular);
}
bool operator==(const match_results& that)const
Expand Down