« Return to Thread: [convert] Now with Boost.Parameter interface.

Re: [convert] Now with Boost.Parameter interface.

by Emre Turkay-5 :: Rate this Message:

Reply to Author | View in Thread

Hi Vladimir,

I think ability to set persistent behavior would be nice. Something like this;

1. convert::set(locale_ = new_locale)(throw_ = true);
2. int i = convert<int>::from(str1, 0);
3. int j = convert<int>::from(str2, 0);

The line #1 effect lines following it (#2 & #3).

Take care,

     emre

On Mon, May 04, 2009 at 02:12:10PM +1000, Vladimir.Batov@... wrote:

> I've incorporated, uploaded to the Vault and started playing with the
> Boost.Parameter-based interface that Andrey Semashev was insisting from
> the set-go. And it is definitely growing on me and I like
>
>         int i = convert<int>::from(str, 0)(locale_ = new_locale)(throw_ =
> true);
>
> instead of the original
>
>         int i = convert<int>::from(str, 0) >> new_locale >> dothrow;
>
> I think people generally did not like locales and dothrow behaving like
> manipulators.
>
> The more I use the Boost.Parameter-based interface the more I am inclined
> to push it further and apply it to manipulators as well. I.e.
>
>         int i = convert<int>::from(str)(radix_ = 16);
>
> instead of the original direct handling of std manipulators.
>
>         int i = convert<int>::from(str) >> std::hex;
>
> Something, again, Andrey was advocating from the start. Now it feels like
> allowing io-stream manipulators exposes too much implementation detail and
> raises some unwarranted expectations.
>
> That raises a few questions that I am hoping people could help me with:
>
> 1. Both interfaces (for locale and dothrow) are currently supported:
>
> #1        int i = convert<int>::from(str, 0)(locale_ = new_locale)(throw_
> = true);
> #2        int i = convert<int>::from(str, 0) >> new_locale >> dothrow;
>
> Should I remove #1?
>
> 2. Both interfaces
>
> #1        int i = convert<int>::from(str, 0) >> std::hex;
> #2        int i = convert<int>::from(str, 0)(radix_ = 16);
>
> are currently supported. Should I move away from direct manipulator
> support and remove #1?
>
> 3. I only managed to figure out how to supply only one Boost.Parameter at
> a time like
>
>         int i = convert<int>::from(str, 0)(locale_ = new_locale)(throw_ =
> true);
>
> I understand how to achieve
>
>         int i = convert<int>::from(str, 0)((locale_ = new_locale, throw_ =
> true));
>
> (with double quotes) but do not want to go there as it looks somewhat
> unorthodox. I cannot figure out how to achieve the following
>
>         int i = convert<int>::from(str, 0)(locale_ = new_locale, throw_ =
> true);
>
> (a list inside single quotes). I remember Andrey mentioning I could do
> that with a Boost.Parameter macro but I admit of not being bright enough
> to figure it out by myself. Any help would be greatly appreciated.
>
> Thanks,
> Vladimir.
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

 « Return to Thread: [convert] Now with Boost.Parameter interface.