C-style struct initialization from initialization list in C++ -


is there syntax allows use struct initialization syntax:

struct { int a; int b; }  int main() {     a = { 1, 2 }; //syntax     return 0; } 

in initialization list? e.g.

class b {      public:      b(int a_, int b_) : obj { a_, b_ } { }    private:     obj; }; 

if have class public member variables, can automatically use same way structs. in c++ there's not way define arbitrary initializer list behavior. in c++0x there is, pointed out here. if happen using gcc, feature supported in gcc 4.4 , above (if compile parameter -std=c++0x)


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -