Commit 7d6baf8a authored by Jan Möbius's avatar Jan Möbius

Merge branch 'make_unique' into 'master'

Update OVM, implement ptr::unique_ptr.

This needs to be one commit as the OVM ptr namespace change is
incompatible with the current namespace alias (ptr=std), and vice-versa.

This updates the submodule to the branch referenced in [OVM PR 13](https://graphics.rwth-aachen.de:9000/OpenVolumeMesh/OpenVolumeMesh/merge_requests/13) and should reference the merge commit in master instead before being merged here.

See merge request !190
parents a922437c 1b89000e
Pipeline #3606 passed with stage
in 41 minutes and 52 seconds
......@@ -39,70 +39,92 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Author$ *
* $Date$ *
* *
\*===========================================================================*/
#ifndef ACG_UTILS_SMARTPOINTER_HH
#define ACG_UTILS_SMARTPOINTER_HH
#ifndef SMARTPOINTER_HH
#define SMARTPOINTER_HH
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
//== DEFINITION =========================================================
/** This set of defines maps the pointer namespaces to the namespace ptr depending on
* the current architecture and compilers.
*/
#if ( (__cplusplus >= 201103L) || (__STDC_VERSION__ >= 201112L) )
// C++11:
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#elif defined(__GXX_EXPERIMENTAL_CXX0X__)
// C++11 via -std=c++0x on gcc:
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#else
// C++98 and TR1:
#if (_MSC_VER >= 1600)
// VStudio 2010 supports some C++11 features
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#elif (_MSC_VER >= 1500)
// hope for TR1 equivalents
#if(_HAS_TR1)
#include <memory>
namespace ptr = std::tr1;
#define ACG_UNIQUE_POINTER_SUPPORTED 0
#else
#pragma warning "TR1 not available! Please install Visual Studio Service Pack 1!"
#endif
#else
// hope for TR1 equivalents
// check for clang5 but switch to tr1 if clang uses libstdc++
#if defined(__clang_major__) && (__clang_major__ >= 5) && !defined(__GLIBCXX__ )
// Mavericks special treatment
#include <memory>
namespace ptr = std;
/*************************************************
* Warning! This header file is duplicated in *
* OpenVolumeMesh with the same header guard, *
* as src/OpenVolumeMesh/System/MemoryInclude.hh.*
* If you change this file, you should change *
* that file as well. *
*************************************************/
#include <memory>
// Default for C++ 11 and higher
#if ((defined(_MSC_VER) && (_MSC_VER >= 1900)) || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__))
// legacy code may depend on this define:
#define ACG_UNIQUE_POINTER_SUPPORTED 1
namespace ptr {
using std::shared_ptr;
using std::make_shared;
using std::unique_ptr;
#if __cplusplus >= 201402L
using std::make_unique;
#else
template<typename T, typename... Args>
std::unique_ptr<T>
make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif // C++14
} // namespace ptr
#else // deprecated things
/** This set of defines maps the pointer namespaces to the namespace ptr depending on
* the current architecture and compilers.
*/
#if ( (__cplusplus >= 201103L) || (__STDC_VERSION__ >= 201112L) )
// C++11:
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#elif defined(__GXX_EXPERIMENTAL_CXX0X__)
// C++11 via -std=c++0x on gcc:
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#else
#include <tr1/memory>
namespace ptr = std::tr1;
// C++98 and TR1:
#if (_MSC_VER >= 1600)
// VStudio 2010 supports some C++11 features
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#elif (_MSC_VER >= 1500)
// hope for TR1 equivalents
#if(_HAS_TR1)
#include <memory>
namespace ptr = std::tr1;
#define ACG_UNIQUE_POINTER_SUPPORTED 0
#else
#pragma warning "TR1 not available! Please install Visual Studio Service Pack 1!"
#endif
#else
// hope for TR1 equivalents
// check for clang5 but switch to tr1 if clang uses libstdc++
#if defined(__clang_major__) && (__clang_major__ >= 5) && !defined(__GLIBCXX__ )
// Mavericks special treatment
#include <memory>
namespace ptr = std;
#else
#include <tr1/memory>
namespace ptr = std::tr1;
#endif
#define ACG_UNIQUE_POINTER_SUPPORTED 0
#endif
#endif
#define ACG_UNIQUE_POINTER_SUPPORTED 0
#endif
#endif
//=============================================================================
#endif // SMARTPOINTER_HH defined
//=============================================================================
#endif // ACG_UTILS_SMARTPOINTER_HH
Subproject commit 82cd0d207d01acf5cdddbf2005e450eed137bad1
Subproject commit a1d43fc2abacec779658bb32ffe22a81f6cac18e
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment