diff options
author | Antony Woods <acron1@gmail.com> | 2013-11-04 08:53:42 +0000 |
---|---|---|
committer | Antony Woods <acron1@gmail.com> | 2013-11-04 08:53:42 +0000 |
commit | 44b4de150a40a21a96ed73a7964e6125a8102f60 (patch) | |
tree | d3adc1dd6a657cf4604639a0ec0696b528e3b4bd | |
parent | a5247cfd2a63ac4ef4820a61d43af0fb10f722ae (diff) |
Revert "Tidied up config.h.in to remove redundant guard"
This reverts commit a5247cfd2a63ac4ef4820a61d43af0fb10f722ae.
-rw-r--r-- | entityx/config.h.in | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/entityx/config.h.in b/entityx/config.h.in index f57794e..934fadc 100644 --- a/entityx/config.h.in +++ b/entityx/config.h.in @@ -5,6 +5,8 @@ #cmakedefine ENTITYX_INSTALLED_PYTHON_PACKAGE_DIR "@ENTITYX_INSTALLED_PYTHON_PACKAGE_DIR@" #cmakedefine ENTITYX_NEED_GET_POINTER_SHARED_PTR_SPECIALIZATION "@ENTITYX_NEED_GET_POINTER_SHARED_PTR_SPECIALIZATION@" +#define ENTITYX_HAVE_STD_SHARED_PTR 1 + #include <stdint.h> #include "entityx/config.h" @@ -12,8 +14,16 @@ namespace entityx { static const uint64_t MAX_COMPONENTS = ENTITYX_MAX_COMPONENTS; +} // namespace entityx + + +// Which shared_ptr implementation should we use? +#if (ENTITYX_HAVE_STD_SHARED_PTR) + #include <memory> +namespace entityx { + template <typename T> using ptr = std::shared_ptr<T>; template <typename T> @@ -25,6 +35,17 @@ ptr<U> static_pointer_cast(const ptr<T> &ptr) { template <typename T> using enable_shared_from_this = std::enable_shared_from_this<T>; +} // namespace entityx + +#else + +#warning "Don't have a std shared_ptr implementation to use" + +#endif + + +namespace entityx { + template <typename T> bool operator == (const weak_ptr<T> &a, const weak_ptr<T> &b) { return a.lock() == b.lock(); |