44// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
55// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
66
7+ // Copyright (c) 2020, Oracle and/or its affiliates.
8+ // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9+
710// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
811// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
912
1417#ifndef BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP
1518#define BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP
1619
20+ #include < type_traits>
21+
1722#include < boost/geometry/algorithms/assign.hpp>
1823
24+ #include < boost/geometry/core/make.hpp>
25+
1926#include < boost/geometry/geometries/concepts/check.hpp>
2027
2128namespace boost { namespace geometry
@@ -32,12 +39,10 @@ namespace detail { namespace make
3239\tparam Range \tparam_range_point
3340\param range \param_range_point
3441\return The constructed geometry, here: a linestring or a ring
35-
3642\qbk{distinguish, with a range}
3743\qbk{
3844[heading Example]
3945[make_with_range] [make_with_range_output]
40-
4146[heading See also]
4247\* [link geometry.reference.algorithms.assign.assign_points assign]
4348}
@@ -75,7 +80,12 @@ inline Geometry make_points(Range const& range)
7580\* [link geometry.reference.algorithms.assign.assign_values_3_2_coordinate_values assign]
7681}
7782*/
78- template <typename Geometry, typename Type>
83+ template
84+ <
85+ typename Geometry,
86+ typename Type,
87+ std::enable_if_t <! traits::make<Geometry>::is_specialized, int > = 0
88+ >
7989inline Geometry make (Type const & c1, Type const & c2)
8090{
8191 concepts::check<Geometry>();
@@ -90,6 +100,23 @@ inline Geometry make(Type const& c1, Type const& c2)
90100 return geometry;
91101}
92102
103+
104+ template
105+ <
106+ typename Geometry,
107+ typename Type,
108+ std::enable_if_t <traits::make<Geometry>::is_specialized, int > = 0
109+ >
110+ constexpr inline Geometry make (Type const & c1, Type const & c2)
111+ {
112+ concepts::check<Geometry>();
113+
114+ // NOTE: This is not fully equivalent to the above because assign uses
115+ // numeric_cast which can't be used here since it's not constexpr.
116+ return traits::make<Geometry>::apply (c1, c2);
117+ }
118+
119+
93120/* !
94121\brief Construct a geometry
95122\ingroup make
@@ -109,7 +136,12 @@ inline Geometry make(Type const& c1, Type const& c2)
109136\* [link geometry.reference.algorithms.assign.assign_values_4_3_coordinate_values assign]
110137}
111138 */
112- template <typename Geometry, typename Type>
139+ template
140+ <
141+ typename Geometry,
142+ typename Type,
143+ std::enable_if_t <! traits::make<Geometry>::is_specialized, int > = 0
144+ >
113145inline Geometry make (Type const & c1, Type const & c2, Type const & c3)
114146{
115147 concepts::check<Geometry>();
@@ -124,6 +156,22 @@ inline Geometry make(Type const& c1, Type const& c2, Type const& c3)
124156 return geometry;
125157}
126158
159+ template
160+ <
161+ typename Geometry,
162+ typename Type,
163+ std::enable_if_t <traits::make<Geometry>::is_specialized, int > = 0
164+ >
165+ constexpr inline Geometry make (Type const & c1, Type const & c2, Type const & c3)
166+ {
167+ concepts::check<Geometry>();
168+
169+ // NOTE: This is not fully equivalent to the above because assign uses
170+ // numeric_cast which can't be used here since it's not constexpr.
171+ return traits::make<Geometry>::apply (c1, c2, c3);
172+ }
173+
174+
127175template <typename Geometry, typename Type>
128176inline Geometry make (Type const & c1, Type const & c2, Type const & c3, Type const & c4)
129177{
0 commit comments