Skip to content

Commit

Permalink
Don't initialize CoordinateSequence in constructor
Browse files Browse the repository at this point in the history
This ought to improve performance in the common case where initialization is unnecessary.
  • Loading branch information
eyal0 authored and esoha-nvidia committed Dec 8, 2022
1 parent d463bcb commit 40be55a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/geom/CoordinateSequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ CoordinateSequence::CoordinateSequence(std::size_t sz, std::size_t dim) :
if (dim == 1 || dim > 4) {
throw util::IllegalArgumentException("Declared dimension must be 2, 3, or 4");
}
initialize();
if (sz > 0 && dim == 0) {
m_vect[0] = geos::geom::Coordinate();
}
}

CoordinateSequence::CoordinateSequence(const std::initializer_list<Coordinate>& list) :
Expand Down

0 comments on commit 40be55a

Please sign in to comment.