Boost logo

Boost :

Subject: Re: [boost] [utility/swap] MSVC 10 test failure, unsigned long to std::bitset conversion invalid?
From: Bo Persson (bop_at_[hidden])
Date: 2010-03-07 08:51:08


Niels Dekker - address until 2010-10-10 wrote:
> On 2010-03-07 01:05, Richard Webb wrote:
>> The change from unsigned long to unsigned long long is a c++0x
>> change (c++98 says the constructor takes an unsigned long, and
>> c++0x changes that to unsigned long long), and i think it was
>> changed just to allow larger values.
>
> Okay, but of course, the bitset(unsigned long long) constructor
> should still support passing an unsigned long as argument.
>
> Note that C++0x also adds the bitset(const char*) constructor. As
> proposed by LWG issue #778, by Thorsten Ottosen:
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3019.html#778
>

And it says that the effect should be as if constructed by
bitset(string(str)). This makes it illegal to use a null pointer, like
0, as this is not allowed for std::string.

>> The int constructor looks like an MS special that was added in the
>> release candidate. I was wondering if it was added to help out
>> with this other bug:
>> https://connect.microsoft.com/VisualStudio/feedback/details/500122/bitset-5-bits-0-fails-with-conflict-between-longlong-and-char
>

Which then isn't a bug at all, but explicitly disallowed by the
standard [lib.string.cons].

Bo Persson


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