Boost logo

Boost :

Subject: Re: [boost] Boost.Convert+Boost.Parameter
From: David Abrahams (dave_at_[hidden])
Date: 2009-02-23 21:57:46


on Sun Feb 22 2009, Vladimir.Batov-AT-wrsa.com.au wrote:

> Trying to use Boost.Parameter as Daniel showed. Wow, that's truly hairy
> stuff. Obviously I get it wrong somewhere as matching Parameters
> constructor cannot be found. I am trying to call
>
> int ii = convert_to<int>("1", boost::convert_parameters::default_
> = -1);
>
> when I have declarations below as (I think) Daniel indicated.
>
> namespace convert_parameters
> {
> BOOST_PARAMETER_NAME((from_, tag) from_)
> BOOST_PARAMETER_NAME((default_, tag) default_)
> }
>
> template<class TypeOut, class ArgumentPack>
> TypeOut
> test(ArgumentPack const& args)
> {
> return TypeOut();
> }
>
> template<
> class TypeOut,
> class TypeIn,
> class A0>
> convert<TypeIn, TypeOut>
> convert_to(TypeIn const& value_in, A0 const& a0)
> {
> typedef
> parameter::parameters<parameter::required<convert_parameters::tag::from_>
> Parameters;
>
> return test<TypeOut>(Parameters(value_in, a0));
> }
>
> Any help? Please?

I'm not sure what you're trying to accomplish here, or what error
message you got, but your ParameterSpec very clearly says that it
accepts only one parameter (which is required), and you're passing it
two.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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