How to turn this C++ into D?
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Nov 5 10:10:36 PST 2014
On 11/05/2014 10:07 AM, Ali Çehreli wrote:
> On 11/05/2014 09:17 AM, Patrick Jeeves wrote:
>
> > class foo
> > {
> > static std::list<foo*> foo_list;
> > typedef std::list<foo*>::iterator iterator;
> > public:
> > foo()
> > {
> > foo_list.push_back(this);
> > }
Argh! I forgot to add an important, perhaps philosophical, point. :)
Continuing the off-topic, an object should be considered constructed
only after hitting that closing curly bracket above. If so, then that
push_back would be adding an incomplete object to the list.
Ali
More information about the Digitalmars-d-learn
mailing list