import std.algorithm;

class Foo 
{
private:
  static int next_id_ = 0;
  int id_;
  this() { id_ = next_id_++; }
public:
  shared int id() const { return id_; }
}


static bool compare(in shared(Foo) a, in shared(Foo) b) 
{
  return (a.id() < b.id());
}

void main() 
{
  shared Foo a,b,c;
  shared(Foo)[] uFooArray = [a,b,c];
  sort!(compare)(uFooArray);
}  