Boost logo

Boost Users :

Subject: Re: [Boost-users] problems with C++ integer types
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-01-31 16:09:27


Steven Watanabe wrote:
> AMDG
>
> On 01/31/2012 09:45 AM, Robert Ramey wrote:
>> So, I've implemented
>> a specialization of std::numeric_limits for my special kind of
>> integer - which is OK by me. BUT, now I wonder about the idea
>> if placing my own code into the std namespace which I would
>> guess might raise other issues.
>>

Well this is sort of interesting. So it seems that I'm off the hook
as far as specializing numeric_limits if I follow a couple of rules.
Now it only remains to decipher the rules.

> C++ 2003, 17.4.3.1:
> "A program may add template specializations for any
> standard library template to namespace std.

OK - got it.

> Such a
> specialization (complete or partial) of a standard
> library template results in undefined behavior

Hmmm - not getting this. How does specialization
result in undefined behavior. The whole purpose of specialization
is to define behavior. Does this mean to say that
any declared specialization should be defined or what?

> unless
> the declaration depends on a user-defined name of external
> linkage

I can't see how this is related to anything. Why should I not
be able to define a specialization locally in one file?

> and unless the specialization meets the standard
> library requirements for the original template."

As far as I can tell. numeric_limits<T> specifies no requirements
on T other than if numeric_limits is specialized for T should also
be specialized for cv variations on T. OK that I get.

No one should feel obligated to answer these questions for
reasons other than pure enjoyment. I'm not hung up on them.

>
> In Christ,
> Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net