forked from luabind/luabind
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include this file if you want to use std::shared_ptr with luabind. Although it's quite hacky, it seems to work with at least VC11 and the g++ included in Ubuntu 12.10.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#ifndef STD_SHAREDPTR_CONVERTER_HPP_INCLUDED | ||
#define STD_SHAREDPTR_CONVERTER_HPP_INCLUDED STD_SHAREDPTR_CONVERTER_HPP_INCLUDED | ||
|
||
#include <boost/version.hpp> | ||
|
||
#if BOOST_VERSION >= 105300 | ||
#include <boost/get_pointer.hpp> | ||
|
||
|
||
namespace luabind { namespace detail { namespace has_get_pointer_ { | ||
template<class T> | ||
struct impl<std::shared_ptr<T>> { | ||
BOOST_STATIC_CONSTANT(bool, value = true); | ||
typedef boost::mpl::bool_<value> type; | ||
}; | ||
|
||
template<class T> | ||
struct impl<const std::shared_ptr<T>>: impl<std::shared_ptr<T>> { }; | ||
|
||
template<class T> | ||
struct impl<volatile std::shared_ptr<T>>: impl<std::shared_ptr<T>> { }; | ||
|
||
template<class T> | ||
struct impl<const volatile std::shared_ptr<T>>: impl<std::shared_ptr<T>> { }; | ||
}} | ||
using boost::get_pointer; | ||
} | ||
|
||
|
||
|
||
#else // if BOOST_VERSION < 105300 | ||
|
||
// Not standard conforming: add function to ::std(::tr1) | ||
namespace std { | ||
|
||
#if defined(_MSC_VER) && _MSC_VER < 1700 | ||
namespace tr1 { | ||
#endif | ||
|
||
template<class T> | ||
T * get_pointer(shared_ptr<T> const& p) { return p.get(); } | ||
|
||
#if defined(_MSC_VER) && _MSC_VER < 1700 | ||
} // namespace tr1 | ||
#endif | ||
|
||
} // namespace std | ||
|
||
#endif // if BOOST_VERSION < 105300 | ||
|
||
#endif |