C ++ 0x Peer Constructor in VC2010

According to the C ++ 0x specification , it is legal

class A {
    A(int i) : x(i) {}
    A() : A(0) {}
    int x;
};

But it cannot compile ( "A" is not a nonstatic data member or base class of class "A") in VC 2010. Does anyone know what happened?

+5
source share
3 answers

Visual C ++ 2010 (also known as VC ++ 10.0) at the time of writing does not support delegation of constructors, which requires a piece of code. VC ++ 10.0 has only partial support for C ++ 0x, and at the time of writing this article, no compiler has implemented the entire set of C ++ 0x functions (although this will change soon, especially after the completion of the C ++ 0x standard).

++ 0x gcc MSVC. ++ 0x . , ++ 0x, Visual ++ 2010 .

:

class A
{ 
public:
    A(int i) : x(i) {} 
    A() : x(0) {} 
private:
    int x; 
};
+8

Visual Studio 0x. ( , 0x .)

, 0x VS 2010.

0

MSV++ 2010

C + 0x .

0

All Articles