Boost logo

Boost :

Subject: Re: [boost] [config] std::unique_ptr, std::ref detection?
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-03-03 13:08:20


On Sat, Mar 3, 2012 at 4:51 AM, Daniel James <dnljms_at_[hidden]> wrote:

> On 1 March 2012 23:34, Jeffrey Lee Hellrung, Jr.
> <jeffrey.hellrung_at_[hidden]> wrote:
> >
> > I think the important distinction is
> >
> > "BOOST_NO_INITIALIZER_LISTS is probably useless as
> > it only indicates compiler support and initializer lists can't really
> > be used without the header."
> >
> > I wasn't sure whether initializer lists required a header, so I agree
> with
> > Daniel that it's probably redundant.
>
> I was wrong, C++11 added other uses which don't require the header.
> Although I don't think portable code would ever need to take advantage
> of that.
>
> The situation with the visual c++ 10 beta was that initializer lists
> weren't supported, but the header was present. In that case
> BOOST_NO_INITIALIZER_LISTS would be defined, but
> BOOST_NO_0X_HDR_INITIALIZER_LISTS would not. A compiled library might
> still want to define methods which take initializer lists so that they
> can be used when linking with a different compiler that does support
> them.
>
> If you look at unordered, it now uses
> BOOST_NO_0X_HDR_INITIALIZER_LISTS in the headers (they support
> std::initializer_list but don't ever create one), but
> BOOST_NO_INITIALIZER_LISTS for test cases that actually use an
> initializer list.
>
> But.... it looks like including the header in Visual C++ 10 was
> actually a mistake:
>
>
> http://connect.microsoft.com/VisualStudio/feedback/details/533464/the-initializer-list-header-in-the-vc10-release-candidate
>

LOL...nice.

> It's also confusing having the two macros, very easy to get wrong, and
> the potential use cases are pretty dubious.
>

I'll ultimately defer to your and others' judgements here. Let me just say
that it does sound like an argument can be made to continue to use
BOOST_NO_INITIALIZER_LISTS (indicating whether the compiler correctly
implements and supports (including header support) initializer lists)
rather than BOOST_NO_0X_HDR_INITIALIZER_LISTS (header is present and...well
who knows what else? should it only be undefined in the former case for
BOOST_NO_INITIALIZER_LISTS?). The former macro is also more succinct.

- Jeff


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