Boost logo

Boost :

Subject: [boost] [config] Macro for initializer-list literals?
From: Peter Dimov (lists_at_[hidden])
Date: 2014-08-09 05:23:34


We have BOOST_NO_CXX11_HDR_INITIALIZER_LIST, which tells us whether we can
#include <initializer_list> and use std::initializer_list; we also have
BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX, which tells us whether we can
use X{ 1, 2 }, or X x{ 1, 2}.

But we don't have a macro that tells us whether this:

struct X
{
    int a, b;
};

void f( X x )
{
}

int main()
{
    f( { 1, 2 } );
}

is supported.

This is a problem for

http://www.boost.org/development/tests/develop/developer/output/Sandia-intel-13-1-c++0x-boost-bin-v2-libs-smart_ptr-test-allocate_shared_arrays_test-test-intel-linux-debug.html

because the test is guarded by BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX:

https://github.com/boostorg/smart_ptr/blob/develop/test/allocate_shared_arrays_test.cpp

and this macro is not set for Intel 13.1 in C++0x mode. Presumably the
compiler allows braced initialization, but not braced literals.


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