Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2006-11-03 06:30:10


Roland Schwarz <roland.schwarz_at_[hidden]> writes:

> Anthony Williams wrote:
>> struct A
>> {
>> constexpr A(int i_):
>> i(i_),j(0)
>> {}
>>
>> int i;
>> int j;
>> };
>>
>> static A a(6); // static initialization, same as {6,0}, but with a constructor.
>
> And such a struct shall be aggregate?

No.

> What if there is something in the body of the ctor?

That's not allowed. The members can be initialized with "constant expressions"
in the member init list. Constant expressions are generalized to include calls
to functions which are themselves marked constexpr.

N1980 is the latest public version of the proposal.

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2006/n1980.pdf

There is a revised version on the committee wiki, which hopefully will be in
the post-Portland mailing.

Anthony

-- 
Anthony Williams
Software Developer
Just Software Solutions Ltd
http://www.justsoftwaresolutions.co.uk

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