Suppose we have following two classes:

class Temp{
     public:
      char a;
      char b;
    };
    class Final{
     private:
      int a;
      char b;
      char c;
     public:
      Final(Temp in):b(in.a),c(in.b){}
      //rest of implementation
    };

can we initialize an object of the Final class with following syntax in upcoming c++0x standard:

Final obj(Temp{'a','b'});

Well, at least with the current draft of C++0x, as implemented by the newest linux g++ compiler (with flag "-std=c++0x"), all of the following work, but not the _exact_ syntax you have up there.

Temp t = {'a','b'};
Final obj(t);
Final obj2({'a','b'});
Final obj3(Temp({'a','b'}));
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.