Give shared_ptr the same treatment.

Here I have defined my own test for the feature. It's not an extensive test
but it checks for the presence of the class.
This commit is contained in:
Matt Williams 2012-11-23 14:16:23 +00:00
parent 989e6ea589
commit 9f5fe452c9
4 changed files with 18 additions and 5 deletions

View File

@ -130,3 +130,4 @@ cxx11_check_feature("rvalue-references" HAS_CXX11_RVALUE_REFERENCES)
cxx11_check_feature("sizeof_member" HAS_CXX11_SIZEOF_MEMBER) cxx11_check_feature("sizeof_member" HAS_CXX11_SIZEOF_MEMBER)
cxx11_check_feature("static_assert" HAS_CXX11_STATIC_ASSERT) cxx11_check_feature("static_assert" HAS_CXX11_STATIC_ASSERT)
cxx11_check_feature("variadic_templates" HAS_CXX11_VARIADIC_TEMPLATES) cxx11_check_feature("variadic_templates" HAS_CXX11_VARIADIC_TEMPLATES)
cxx11_check_feature("shared_ptr" HAS_CXX11_SHARED_PTR)

View File

@ -0,0 +1,7 @@
#include <memory>
int main()
{
std::shared_ptr<int> test;
return 0;
}

View File

@ -7,4 +7,6 @@
#cmakedefine HAS_CXX11_CSTDINT_H #cmakedefine HAS_CXX11_CSTDINT_H
#cmakedefine HAS_CXX11_SHARED_PTR
#endif #endif

View File

@ -67,9 +67,6 @@ freely, subject to the following restrictions:
//To support old (pre-vc2010) Microsoft compilers we use boost to replace the //To support old (pre-vc2010) Microsoft compilers we use boost to replace the
//std::shared_ptr and potentially other C++0x features. To use this capability you //std::shared_ptr and potentially other C++0x features. To use this capability you
//will need to make sure you have boost installed on your system. //will need to make sure you have boost installed on your system.
#include <boost/smart_ptr.hpp>
#define polyvox_shared_ptr boost::shared_ptr
#include <boost/function.hpp> #include <boost/function.hpp>
#define polyvox_function boost::function #define polyvox_function boost::function
@ -80,8 +77,6 @@ freely, subject to the following restrictions:
#else #else
//We have a decent compiler - use real C++0x features //We have a decent compiler - use real C++0x features
#include <functional> #include <functional>
#include <memory>
#define polyvox_shared_ptr std::shared_ptr
#define polyvox_function std::function #define polyvox_function std::function
#define polyvox_bind std::bind #define polyvox_bind std::bind
#define polyvox_placeholder_1 std::placeholders::_1 #define polyvox_placeholder_1 std::placeholders::_1
@ -115,4 +110,12 @@ freely, subject to the following restrictions:
using boost::uint32_t; using boost::uint32_t;
#endif #endif
#if defined(HAS_CXX11_SHARED_PTR)
#include <memory>
#define polyvox_shared_ptr std::shared_ptr
#else
#include <boost/smart_ptr.hpp>
#define polyvox_shared_ptr boost::shared_ptr
#endif
#endif #endif