c++ - Why is a default ctor needed for this inner (nested) struct? -


i trying compile code similar snippet below:

class system { private:    struct configuration    {       configuration(/*params*/);       configuration(const configuration&);       configuration& operator=(const configuration&);       ~configuration();        /* member variables */    } m_config;     explicit system(const configuration& cfg);     // non copyable constructable, non assignable    system(const system&);    system& operator= (const system&);  public:     system();     ~system();   }   //implementation system::system() {    m_config = configuration(/*default params*/);    // .... } 

compiler error: no matching function call ‘system::configuration::configuration()’

when provide (even merely declaration not definition of) default constructor nested struct, error dissapears - why?!

misc details: gcc version 4.4.3 (ubuntu 4.4.3-4ubuntu5)

m_config first default constructed , assigned. use member list set value directly.

system::system()   : m_config(/*default params*/) {} 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -