Dear Jim,

I remember having some troubles using boost::optional with boost::program_options.
I fixed it by adding the following lines:

namespace boost
{
// Add custom validator to use boost::program_options on boost::optional<> types
template<class T>
void validate(boost::any& v, std::vector<std::string> const& values, boost::optional<T>* typeTag, int)
{
    if (!values.empty())
    {
        boost::any a;
        using namespace boost::program_options;
        validate(a, values, (T*)0, 0);
        v = boost::any(boost::optional<T>(boost::any_cast<T>(a)));
    }
}
}

I don’t remember the details, but I think I took that from more recent version of Boost to be able to use my code with older version of Boost.
With that, my code compiles and runs fine

I hope this will help.

Best regards,

Xavier


On Tue, Jun 5, 2018 at 5:21 PM degski via Boost-users <boost-users@lists.boost.org> wrote:
On 5 June 2018 at 15:41, Chris Glover via Boost-users <boost-users@lists.boost.org> wrote:
Regardless of what was written above (or what permeates reddit, etc), most shops are still using VS2015 or lower, so it does matter, actually.

If one doesn't care about bugs in compiler, STL and IDE, and support for later standards, why would one care to upgrade Boost at all?

I was quoting Steven T. Lavavej (STL) and Billy O'Neill, who both have leading roles in VC (and its STL) development. The fact you saw it on reddit.com might have something to do with the fact that STL is also one of the moderators of /r/cpp.

degski
--
"If something cannot go on forever, it will stop" - Herbert Stein
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users


--
Dr Xavier BESSERON
Research associate
FSTC, University of Luxembourg
Campus Belval, Office MNO E04 0415-040
Phone: +352 46 66 44 5418