Boost logo

Boost :

Subject: Re: [boost] [parameter] BOOST_PARAMETER_CONSTRUCTOR bug
From: James Hirschorn (james.hirschorn_at_[hidden])
Date: 2013-05-21 17:29:29


Nathan Crookston wrote:

> James Hirschorn wrote:
>
> I believe when you have an optional constructor parameter, you must access
> it with the default value supplied:
>
> struct myclass_impl
> {
> template <class ArgumentPack>
> myclass_impl(ArgumentPack const& args)
> {
> std::cout << "name = " << args[_name | ""]
> << "; index = " << args[_index | 0]
> << std::endl;
> }
> };
>
> (Note the bitwise or "|"). This is a little different than for named
> function parameters, it seems.
>
> HTH,
> Nate
>

Yes, that works. I should have checked here before making the report...

Thanks,
James


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk