
3 Nov
2006
3 Nov
'06
8:51 a.m.
Roland Schwarz <roland.schwarz@chello.at> writes:
Anthony Williams wrote:
If the constexpr proposal gets accepted into the C++ Standard, we won't have to worry about this in the future --- constructors that just use constant expressions can be tagged "constexpr", and used for static initialization.
What does this mean, can you please illustrate it with an example?
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. Anthony -- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk