Skip to content

Commit

Permalink
Geography move constructor optimization
Browse files Browse the repository at this point in the history
No need to infer geography properties.
  • Loading branch information
benbovy committed Oct 21, 2024
1 parent c94fa0a commit 1035563
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/geography.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ enum class GeographyType : std::int8_t {
class Geography {
public:
Geography(const Geography&) = delete;
Geography(Geography&& geog) : m_s2geog_ptr(std::move(geog.m_s2geog_ptr)) {
extract_geog_properties();
}
Geography(Geography&& geog)
: m_s2geog_ptr(std::move(geog.m_s2geog_ptr)),
m_is_empty(geog.is_empty()),
m_geog_type(geog.geog_type()) {}

Geography(S2GeographyPtr&& s2geog_ptr) : m_s2geog_ptr(std::move(s2geog_ptr)) {
// TODO: template constructors with s2geography Geography subclass constraints (e.g., using
// SFINAE or "if constexpr") may be more efficient than dynamic casting like done in
// extract_geog_properties.
extract_geog_properties();
}

Expand Down

0 comments on commit 1035563

Please sign in to comment.