Skip to content

Commit 0030692

Browse files
committed
Avoid awkward special case for point class
1 parent 8b7d01a commit 0030692

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/geom.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,21 @@ class multigeometry_t
200200
using iterator = typename std::vector<GEOM>::iterator;
201201
using value_type = GEOM;
202202

203-
static constexpr bool FOR_POINT = std::is_same_v<GEOM, point_t>;
204-
205203
[[nodiscard]] std::size_t num_geometries() const noexcept
206204
{
207205
return m_geometry.size();
208206
}
209207

210-
GEOM &
211-
add_geometry(typename std::conditional_t<FOR_POINT, point_t, GEOM &&> geom)
208+
GEOM &add_geometry(GEOM const &geom)
209+
{
210+
m_geometry.push_back(geom);
211+
return m_geometry.back();
212+
}
213+
214+
template <typename T>
215+
GEOM &add_geometry(T &&geom)
212216
{
213-
m_geometry.push_back(std::forward<GEOM>(geom));
217+
m_geometry.push_back(std::forward<T>(geom));
214218
return m_geometry.back();
215219
}
216220

0 commit comments

Comments
 (0)