Skip to content

Commit 38e7ea8

Browse files
committed
Implement variables_map::clear to clear extra members.
Fixes #4927 [SVN r67772]
1 parent 5b7fbb5 commit 38e7ea8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

include/boost/program_options/variables_map.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ namespace boost { namespace program_options {
153153
// Resolve conflict between inherited operators.
154154
const variable_value& operator[](const std::string& name) const
155155
{ return abstract_variables_map::operator[](name); }
156+
157+
// Override to clear some extra fields.
158+
void clear();
156159

157160
void notify();
158161

src/variables_map.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ namespace boost { namespace program_options {
182182
: abstract_variables_map(next)
183183
{}
184184

185+
void variables_map::clear()
186+
{
187+
std::map<std::string, variable_value>::clear();
188+
m_final.clear();
189+
m_required.clear();
190+
}
191+
185192
const variable_value&
186193
variables_map::get(const std::string& name) const
187194
{

0 commit comments

Comments
 (0)