Commit 47e09f81 authored by Robert Menzel's avatar Robert Menzel

more robust C++11 detection, no Unique Pointers is only TR1 is available

parent 94da98a3
......@@ -43,14 +43,24 @@
// C++11:
# include <memory>
namespace ptr = std;
# define ACGL_UNIQUE_POINTER_SUPPORTED 1
#elif defined(__GXX_EXPERIMENTAL_CXX0X__)
// C++11 via -std=c++0x on gcc:
# include <memory>
namespace ptr = std;
# define ACGL_UNIQUE_POINTER_SUPPORTED 1
#else
// C++98 and TR1:
# ifdef _MSC_VER
# if (_MSC_VER >= 1600)
// VStudio 2010 supports some C++11 features
# include <memory>
namespace ptr = std;
# define ACGL_UNIQUE_POINTER_SUPPORTED 1
# else
// hope for TR1 equivalents
# include <tr1/memory>
namespace ptr = std::tr1;
# define ACGL_UNIQUE_POINTER_SUPPORTED 0
# endif
#endif
......
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University //
// Copyright (c) 2011, 2012 Computer Graphics Group RWTH Aachen University //
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
......@@ -12,14 +12,24 @@ private:\
Class(const Class& ){ }\
void operator=(Class& ){ }
// creates typedefs for a given class for each smartpointer type
#define ACGL_SMARTPOINTER_TYPEDEFS(Class) \
# if (ACGL_UNIQUE_POINTER_SUPPORTED == 1)
// C++11:
# define ACGL_SMARTPOINTER_TYPEDEFS(Class) \
typedef ptr::shared_ptr<Class> Shared ## Class; \
typedef ptr::shared_ptr<const Class> ConstShared ## Class; \
typedef ptr::weak_ptr<Class> Weak ## Class; \
typedef ptr::weak_ptr<const Class> ConstWeak ## Class; \
typedef ptr::unique_ptr<Class> Unique ## Class; \
typedef ptr::unique_ptr<const Class> ConstUnique ## Class;
#else
// TR1 does not have unique pointers
# define ACGL_SMARTPOINTER_TYPEDEFS(Class) \
typedef ptr::shared_ptr<Class> Shared ## Class; \
typedef ptr::shared_ptr<const Class> ConstShared ## Class; \
typedef ptr::weak_ptr<Class> Weak ## Class; \
typedef ptr::weak_ptr<const Class> ConstWeak ## Class;
#endif
#endif // MACROS_HH
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