[geos-devel] Reviewing std::auto_ptr spaghetti

Mateusz Loskot mateusz at loskot.net
Wed Sep 6 07:24:45 PDT 2017


In C++, well-established patterns when/how to use std::auto_ptr are:

void sink(std::auto_ptr<T> p);
std::auto_ptr<T> source();

TL;TR: Is it safe to assume GEOS follows the patterns?

In the code, there are uses of std::auto_ptr that are hard to reason about
what makes me suspicious:

class T
  auto_ptr items;
    auto_ptr<A> getItems()
        return items;

Is the intention to give up the object's internal resource, really?

For example, in LineSegmentVisitor and possibly (lot) more places.

Best regards,
Mateusz Loskot, http://mateusz.loskot.net

More information about the geos-devel mailing list