===================================================================
RCS file: /cvsroot/boost/boost/boost/program_options/value_semantic.hpp,v
retrieving revision 1.13
diff -u -r1.13 value_semantic.hpp
--- boost/program_options/value_semantic.hpp	23 Nov 2005 09:14:01 -0000	1.13
+++ boost/program_options/value_semantic.hpp	22 Jul 2007 05:30:43 -0000
@@ -204,6 +204,21 @@
             return this;
         }
 
+        typed_value* implicit_value(const T &v)
+        {
+            m_implicit_value = boost::any(v);
+            m_implicit_value_as_text =
+                boost::lexical_cast<std::string>(v);
+            return this;
+        }
+
+        typed_value* implicit_value(const T &v, const std::string& textual)
+        {
+            m_implicit_value = boost::any(v);
+            m_implicit_value_as_text = textual;
+            return this;
+        }
+
         /** Specifies a function to be called when the final value
             is determined. */
         typed_value* notifier(function1<void, const T&> f)
@@ -243,7 +258,7 @@
 
         unsigned min_tokens() const
         {
-            if (m_zero_tokens) {
+            if (m_zero_tokens || !m_implicit_value.empty()) {
                 return 0;
             } else {
                 return 1;
@@ -301,6 +316,8 @@
         // as boost::optional to avoid unnecessary instantiations.
         boost::any m_default_value;
         std::string m_default_value_as_text;
+        boost::any m_implicit_value;
+        std::string m_implicit_value_as_text;
         bool m_composing, m_implicit, m_multitoken, m_zero_tokens;
         boost::function1<void, const T&> m_notifier;
     };
===================================================================
RCS file: /cvsroot/boost/boost/boost/program_options/detail/value_semantic.hpp,v
retrieving revision 1.15
diff -u -r1.15 value_semantic.hpp
--- boost/program_options/detail/value_semantic.hpp	16 Jun 2005 10:29:48 -0000	1.15
+++ boost/program_options/detail/value_semantic.hpp	22 Jul 2007 05:30:43 -0000
@@ -16,9 +16,13 @@
     std::string
     typed_value<T, charT>::name() const
     {
-        if (!m_default_value.empty() && !m_default_value_as_text.empty()) {
+        if (!m_implicit_value.empty() && !m_implicit_value_as_text.empty()) {
+            return "[=arg] (=" + m_implicit_value_as_text + ")";
+        }
+        else if (!m_default_value.empty() && !m_default_value_as_text.empty()) {
             return arg + " (=" + m_default_value_as_text + ")";
-        } else {
+        }
+        else {
             return arg;
         }
     }
@@ -27,7 +31,11 @@
     void 
     typed_value<T, charT>::notify(const boost::any& value_store) const
     {
-        const T* value = boost::any_cast<const T>(&value_store);
+        const T* value;
+        if (value_store.empty())
+            value = boost::any_cast<const T>(&m_implicit_value);
+        else
+            value = boost::any_cast<const T>(&value_store);
         if (m_store_to) {
             *m_store_to = *value;
         }
@@ -148,7 +156,8 @@
     xparse(boost::any& value_store, 
            const std::vector<std::basic_string<charT> >& new_tokens) const
     {
-        validate(value_store, new_tokens, (T*)0, 0);
+        if (!new_tokens.empty() || m_implicit_value.empty())
+            validate(value_store, new_tokens, (T*)0, 0);
     }
 
     template<class T>
===================================================================
RCS file: /cvsroot/boost/boost/libs/program_options/src/cmdline.cpp,v
retrieving revision 1.23
diff -u -r1.23 cmdline.cpp
--- libs/program_options/src/cmdline.cpp	24 Apr 2006 09:14:57 -0000	1.23
+++ libs/program_options/src/cmdline.cpp	22 Jul 2007 05:30:51 -0000
@@ -329,6 +329,13 @@
             
             max_tokens -= opt.value.size();
 
+            // A value is optional if min_tokens == 0, but max_tokens > 0.
+            // If a value is optional, it must appear in opt.value (because
+            // it was 'adjacent'.  Otherwise, remove the expectation of a
+            // non-adjacent value.
+            if (min_tokens == 0 && max_tokens > 0 && opt.value.empty())
+                --max_tokens;
+
             // Everything's OK, move the values to the result.            
             for(;!other_tokens.empty() && max_tokens--; ) {
                 opt.value.push_back(other_tokens[0]);
