Index: boost/program_options/detail/value_semantic.hpp =================================================================== --- boost/program_options/detail/value_semantic.hpp (revision 67142) +++ boost/program_options/detail/value_semantic.hpp (working copy) @@ -31,14 +31,14 @@ template void - typed_value::notify(const boost::any& value_store) const + typed_value::notify(std::string const& key, const boost::any& value_store) const { const T* value = boost::any_cast(&value_store); if (m_store_to) { *m_store_to = *value; } if (m_notifier) { - m_notifier(*value); + m_notifier(key, *value); } } Index: boost/program_options/value_semantic.hpp =================================================================== --- boost/program_options/value_semantic.hpp (revision 67142) +++ boost/program_options/value_semantic.hpp (working copy) @@ -10,7 +10,7 @@ #include #include -#include +#include #include @@ -66,7 +66,7 @@ /** Called when final value of an option is determined. */ - virtual void notify(const boost::any& value_store) const = 0; + virtual void notify(std::string const& key, const boost::any& value_store) const = 0; virtual ~value_semantic() {} }; @@ -151,7 +151,7 @@ bool apply_default(boost::any&) const { return false; } /** Does nothing. */ - void notify(const boost::any&) const {} + void notify(std::string const& key, const boost::any&) const {} private: bool m_zero_tokens; }; @@ -246,7 +246,7 @@ /** Specifies a function to be called when the final value is determined. */ - typed_value* notifier(function1 f) + typed_value* notifier(function2 f) { m_notifier = f; return this; @@ -331,7 +331,7 @@ /** If an address of variable to store value was specified when creating *this, stores the value there. Otherwise, does nothing. */ - void notify(const boost::any& value_store) const; + void notify(std::string const& key, const boost::any& value_store) const; public: // typed_value_base overrides @@ -351,7 +351,7 @@ boost::any m_implicit_value; std::string m_implicit_value_as_text; bool m_composing, m_implicit, m_multitoken, m_zero_tokens, m_required; - boost::function1 m_notifier; + boost::function2 m_notifier; }; Index: libs/program_options/src/variables_map.cpp =================================================================== --- libs/program_options/src/variables_map.cpp (revision 67141) +++ libs/program_options/src/variables_map.cpp (working copy) @@ -224,7 +224,7 @@ https://svn.boost.org/trac/boost/ticket/2782 */ if (k->second.m_value_semantic) - k->second.m_value_semantic->notify(k->second.value()); + k->second.m_value_semantic->notify(k->first, k->second.value()); } }