Sunday, 11 August 2013

Initializing data members in class definition

Initializing data members in class definition

I thought this was now valid in c++11? Have I done something wrong, or is
this simply not yet implemented in visual studio 2013 at this time? I
can't find anything that says it's not but I can't find anything that says
it is either...
class Test
{
private:
int* data_ = nullptr;
};
Gives me :- Error 1 error C2864: 'Test::data_' : only static const
integral data members can be initialized within a class

No comments:

Post a Comment