T
trinisi.news
Hello,
I have a quick question about syntax and class static variables. I have
a non-copyable (boost::noncopyable, in fact) static member variable. I
have to therefore initialize it in some TU.
class noncopyable_class : boost::noncopyable { /* ... */ };
class example {
/* ... */
static non_copyable_class xyxxy;
};
/* ... */
example::xyxxy = non_copyable_class(); /* nope, no copies allowed */
example::xyxxy(non_copyable_class()); /* nope, same thing */
example::xyxxy; /* looks like a declaration, not a definition, to me */
As it stands, I've used this last version. It looks an awful lot like
a declaration to me, however, so I'm wondering if I have UB because of
a non-defined static member variable?
I have a quick question about syntax and class static variables. I have
a non-copyable (boost::noncopyable, in fact) static member variable. I
have to therefore initialize it in some TU.
class noncopyable_class : boost::noncopyable { /* ... */ };
class example {
/* ... */
static non_copyable_class xyxxy;
};
/* ... */
example::xyxxy = non_copyable_class(); /* nope, no copies allowed */
example::xyxxy(non_copyable_class()); /* nope, same thing */
example::xyxxy; /* looks like a declaration, not a definition, to me */
As it stands, I've used this last version. It looks an awful lot like
a declaration to me, however, so I'm wondering if I have UB because of
a non-defined static member variable?