Re: [boost] Boost.Convert+Boost.Parameter

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? Thanks, Vladimir.

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

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, Yes, indeed I passed only "required". The reason for that is I used Daniel's example BOOST_PARAMETER_NAME(value) typedef parameters<required<tag::value> > convert_parameters; template <class U, class T, class A0, ...> U convert_to(T const& value, A0 const& a0, ...) { return convert_impl<U>(convert_parameters(value, a0, ...)); } where he seemingly declared only "required" (value) but then packed more (value, a0, ...). And that is as I understand what Andrey would like to have in Boost.Convert for formatting purposes. Namely, the user creates his own Boost.Parameter keyword and passes it to Boost.Convert. Boost.Convert obviously does not know about that user-defined keyword but takes it in anyway and somehow makes it available somewhere in a user-defined Boost.Parameter-aware formatter. At least that's how I understand what Andrey wanted. That said, I myself won't be pursuing that issue as I know too little about Boost.Parameter and even though I am determined to get to know and use it, it'll be another project for another day as it'll take more than taking a few Boost.Parameters in. I feel that is well out of the scope of Boost.Convert in its current shape and form. Thanks, V.
participants (3)
-
David Abrahams
-
Vladimir Batov
-
Vladimir.Batov@wrsa.com.au