Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: Boost.Convert
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-02-23 11:13:31


On Sunday, February 22, 2009 11:31 PM
Vladimir Batov wrote:
>
> Now I understand that Boost.Parameter allows me to call
>
> convert<string, int>(str, some_user_defined_param = ...);
>
> As I understand Boost.Convert does not know and does not make use of
> "some_user_defined_param" but takes it in using ArgumentPack.
> How then does
> the parameter make it to some user-defined formatter? Maybe
> it is because I
> am still thinking in terms of manipulators -- a user writes
> his own and
> plugs it into Boost.Convert as
>
> convert_to<int>(str) >> std::hex;
>
> How do we do that with Boost.Parameter? Should we
> write/specify some kind of
> Boost.Parameter-aware manipulator? What the signature then
> might be? Is
> there some other way?

std::hex assumes some state in the stream for storing that hexadecimal formatting should be used in a subsequent conversion step. IOStreams provides a means to tack on extra state not built in (iword(), pword(), and xalloc()), so that's how user-defined formatting could save state to be used later, but it still requires the cooperation of the manipulators to set the state and the formatting logic invoked later.

That same, save state and use it later when converting is needed for something like convert.

> convert<string, int>(str, default_ = -1, throw_ = false);
>
> indeed looks trendy and I probably could extend the convert()
> interface that
> far. However, I understand Andrey's interest is in the user
> providing his
> own keyword (like throw_on_out_of_range_) so that it could be
> used somewhere
> for formatting. Where and how that's what I am having
> difficulty with (due
> to no experience with Boost.Parameter).

I'd still like to see a coherent set of requirements. There are too many forces tugging on the concept from what appear to be competing directions.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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