News for hackers. Stuff that matters.
Re:Bjarne Stroustrup – The Essence of C++ [video] by kybernetyk on Tuesday September 17, 2013 @06:47AM (#6398549)
you can always fake a defer:

    void f(int n, int x) {
      Gadget g = new Gadget(n);
      std::shared_ptr<void> defer(nullptr, [g](void *) {
        delete g;
      });
    ...
But honestly ... I'd just use a stack allocated object - or a smart pointer. In the last year I didn't write one delete. (I'm a full time C++ dev).

There are no comments on this comment yet.