How to turn this C++ into D?

2014-11-05 Thread Patrick Jeeves via Digitalmars-d-learn
So this is more a stackoverflow question, but I feel like later searchers will be more likely to find it if I put it here. if I have the following C++ code: class foo { static std::list foo_list; typedef std::list::iterator iterator; public: foo() { foo_list.push_back(this);

Re: How to turn this C++ into D?

2014-11-05 Thread Patrick Jeeves via Digitalmars-d-learn
On Wednesday, 5 November 2014 at 18:56:08 UTC, luminousone wrote: unless delete is explicitly called, I don't believe the destructor would ever be called, it would still have a reference in the static foo_list object that would stop it from being collected by the gc. This is exactly why I ask

Re: How to turn this C++ into D?

2014-11-05 Thread Patrick Jeeves via Digitalmars-d-learn
On Wednesday, 5 November 2014 at 19:44:57 UTC, luminousone wrote: On Wednesday, 5 November 2014 at 19:05:32 UTC, Patrick Jeeves wrote: On Wednesday, 5 November 2014 at 18:56:08 UTC, luminousone wrote: unless delete is explicitly called, I don't believe the destructor would ever be called, it wo

Curiously Cyclic Template Pattern causes segfault?

2014-11-05 Thread Patrick Jeeves via Digitalmars-d-learn
When I tried to test out the following code the compiler segfaulted: interface BarBase { void do_a_thing(); } interface Bar(T) : BarBase { static if(hasMember!(T, "rotation") && is(typeof(T.rotation) == double)) { @property double rotation()