Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67772 - in trunk: boost/program_options libs/program_options/src
From: ghost_at_[hidden]
Date: 2011-01-08 05:39:22


Author: vladimir_prus
Date: 2011-01-08 05:39:21 EST (Sat, 08 Jan 2011)
New Revision: 67772
URL: http://svn.boost.org/trac/boost/changeset/67772

Log:
Implement variables_map::clear to clear extra members.
Fixes #4927

Text files modified:
   trunk/boost/program_options/variables_map.hpp | 3 +++
   trunk/libs/program_options/src/variables_map.cpp | 7 +++++++
   2 files changed, 10 insertions(+), 0 deletions(-)

Modified: trunk/boost/program_options/variables_map.hpp
==============================================================================
--- trunk/boost/program_options/variables_map.hpp (original)
+++ trunk/boost/program_options/variables_map.hpp 2011-01-08 05:39:21 EST (Sat, 08 Jan 2011)
@@ -153,6 +153,9 @@
         // Resolve conflict between inherited operators.
         const variable_value& operator[](const std::string& name) const
         { return abstract_variables_map::operator[](name); }
+
+ // Override to clear some extra fields.
+ void clear();
         
         void notify();
 

Modified: trunk/libs/program_options/src/variables_map.cpp
==============================================================================
--- trunk/libs/program_options/src/variables_map.cpp (original)
+++ trunk/libs/program_options/src/variables_map.cpp 2011-01-08 05:39:21 EST (Sat, 08 Jan 2011)
@@ -182,6 +182,13 @@
     : abstract_variables_map(next)
     {}
 
+ void variables_map::clear()
+ {
+ std::map<std::string, variable_value>::clear();
+ m_final.clear();
+ m_required.clear();
+ }
+
     const variable_value&
     variables_map::get(const std::string& name) const
     {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk