Skip to content

Commit c1f4912

Browse files
committed
[geometries] Enable model::point's ctors only if Dimension match.
This allows to check if a constructor is implemented with std::is_constructible without compilation errors with clang-3.5-3.9.
1 parent acbd143 commit c1f4912

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

include/boost/geometry/geometries/point.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ class point
8282
// passed for non-Cartesian coordinate systems.
8383
enum { cs_check = sizeof(CoordinateSystem) };
8484

85+
template <typename DT, bool Condition, typename T = void>
86+
struct enable_ctor_if
87+
: std::enable_if<Condition, T>
88+
{};
89+
8590
public:
8691

8792
// TODO: constexpr requires LiteralType and until C++20
@@ -124,6 +129,11 @@ class point
124129
}
125130

126131
/// @brief Constructor to set two values
132+
template
133+
<
134+
typename T = CoordinateType,
135+
typename enable_ctor_if<T, (DimensionCount >= 2), int>::type = 0
136+
>
127137
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
128138
constexpr
129139
#endif
@@ -137,6 +147,11 @@ class point
137147
}
138148

139149
/// @brief Constructor to set three values
150+
template
151+
<
152+
typename T = CoordinateType,
153+
typename enable_ctor_if<T, (DimensionCount >= 3), int>::type = 0
154+
>
140155
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
141156
constexpr
142157
#endif

0 commit comments

Comments
 (0)