26 #include <type_traits> 35 ignore_unused_variable_warning(T
const &) {}
38 #if __cplusplus >= 201402L 39 using std::make_unique;
45 typedef std::unique_ptr<T> _Single_object;
49 struct _Unique_if<T[]> {
50 typedef std::unique_ptr<T[]> _Unknown_bound;
53 template<
class T, std::
size_t N>
54 struct _Unique_if<T[N]> {
55 typedef void _Known_bound;
58 template<
class T,
class... Args>
59 typename _Unique_if<T>::_Single_object
60 make_unique(Args &&... args) {
61 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
65 typename _Unique_if<T>::_Unknown_bound
66 make_unique(std::size_t n) {
67 typedef typename std::remove_extent<T>::type U;
68 return std::unique_ptr<T>(
new U[n]());
71 template<
class T,
class... Args>
72 typename _Unique_if<T>::_Known_bound
73 make_unique(Args &&...) =
delete;
86 template<
typename To,
typename From>
inline To down_cast(From* f)
89 (std::is_base_of<From,
90 typename std::remove_pointer<To>::type>::value),
91 "target type not derived from source type");
93 assert(f ==
nullptr || dynamic_cast<To>(f) !=
nullptr);
95 return static_cast<To
>(f);
103 #if __GNUC__ > 0 && __GNUC__ < 5 104 #define RETURN_UNIQUE_PTR(x) (std::move(x)) 106 #define RETURN_UNIQUE_PTR(x) (x) 112 #endif // GEOS_UTIL_H Basic namespace for all GEOS functionalities.
Definition: Angle.h:25