24 #include <geos/util/GEOSException.h>
25 #include <geos/util/IllegalArgumentException.h>
26 #include <geos/util/TopologyException.h>
27 #include <geos/util/GeometricShapeFactory.h>
30 #include <type_traits>
39 ignore_unused_variable_warning(T
const &) {}
42 #if __cplusplus >= 201402L
43 using std::make_unique;
49 typedef std::unique_ptr<T> _Single_object;
53 struct _Unique_if<T[]> {
54 typedef std::unique_ptr<T[]> _Unknown_bound;
57 template<
class T, std::
size_t N>
58 struct _Unique_if<T[N]> {
59 typedef void _Known_bound;
62 template<
class T,
class... Args>
63 typename _Unique_if<T>::_Single_object
64 make_unique(Args &&... args) {
65 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
69 typename _Unique_if<T>::_Unknown_bound
70 make_unique(std::size_t n) {
71 typedef typename std::remove_extent<T>::type U;
72 return std::unique_ptr<T>(
new U[n]());
75 template<
class T,
class... Args>
76 typename _Unique_if<T>::_Known_bound
77 make_unique(Args &&...) =
delete;
90 template<
typename To,
typename From>
inline To down_cast(From* f)
93 (std::is_base_of<From,
94 typename std::remove_pointer<To>::type>::value),
95 "target type not derived from source type");
97 assert(f ==
nullptr ||
dynamic_cast<To
>(f) !=
nullptr);
99 return static_cast<To
>(f);
107 #if __GNUC__ > 0 && __GNUC__ < 5
108 #define RETURN_UNIQUE_PTR(x) (std::move(x))
110 #define RETURN_UNIQUE_PTR(x) (x)
Basic namespace for all GEOS functionalities.
Definition: Angle.h:26