/********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.osgeo.org * * Copyright (C) 2001-2002 Vivid Solutions Inc. * Copyright (C) 2006 Refractions Research Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * ********************************************************************** * * Utility header to retain a bit of backward compatibility. * Try to avoid including this header directly. * **********************************************************************/ #ifndef GEOS_UTIL_H #define GEOS_UTIL_H //#include #include #include #include //#include //#include //#include #include //#include #include // // Private macros definition // namespace geos { template void ignore_unused_variable_warning(T const &) {} namespace detail { #if __cplusplus >= 201402L using std::make_unique; #else // Backport of std::make_unique to C++11 // Source: https://stackoverflow.com/a/19472607 template struct _Unique_if { typedef std::unique_ptr _Single_object; }; template struct _Unique_if { typedef std::unique_ptr _Unknown_bound; }; template struct _Unique_if { typedef void _Known_bound; }; template typename _Unique_if::_Single_object make_unique(Args &&... args) { return std::unique_ptr(new T(std::forward(args)...)); } template typename _Unique_if::_Unknown_bound make_unique(size_t n) { typedef typename std::remove_extent::type U; return std::unique_ptr(new U[n]()); } template typename _Unique_if::_Known_bound make_unique(Args &&...) = delete; #endif } } #endif // GEOS_UTIL_H