Boost logo

Boost :

Subject: Re: [boost] numeric_cast
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-06-23 10:33:22

Fernando Cacciola wrote:
> But this won't address the problem Brandon is trying to solve:
> namely, to allow numeric_cast<> --and no other function-- to
> really work with custom numeric types (which might have
> specific policy requirements).
> I do understand Antony's concern, but I think is a bit of a red
> herring. That is, I doubt it could really happen in practice,
> even though it technically could.

In the normal case, the UDT header would include the specialization so anytime the UDT is defined, the specialization would be visible. I suppose one might wish to avoid the numeric_cast dependency and put the specialization in another header, though. That would lead to the problem Antony was referring to.

> In any case, what is really important IMO is the keep the
> behaviour stable for the fundamental types.


> Thus a reasonable balance could be, IMO, that the additional
> traits is given already specialized for the fundamental types.
> This way, the extensibility is only really available for
> custom types. Sort of the way numeric_limits<> works.

That seems reasonable.

Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP

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, gregod at, cpdaniel at, john at