48 #ifndef OME_COMPAT_MEMORY_H 49 # define OME_COMPAT_MEMORY_H 51 # include <ome/common/config.h> 53 # ifdef OME_HAVE_MEMORY 55 # elif OME_HAVE_BOOST_SHARED_PTR 56 # include <boost/enable_shared_from_this.hpp> 57 # include <boost/make_shared.hpp> 58 # include <boost/shared_ptr.hpp> 59 # ifdef OME_HAVE_BOOST_OWNER_LESS 60 # include <boost/smart_ptr/owner_less.hpp> 62 # include <functional> 70 template<
typename T>
class shared_ptr;
71 template<
typename T>
class weak_ptr;
75 template<
typename T,
typename U>
76 struct generic_owner_less :
public std::binary_function<T, T, bool>
78 bool operator()(
const T &lhs,
const T &rhs)
const 82 bool operator()(
const T &lhs,
const U &rhs)
const 84 return weak_ptr<typename T::element_type>(lhs) < weak_ptr<typename T::element_type>(rhs);
86 bool operator()(
const U &lhs,
const T &rhs)
const 88 return weak_ptr<typename T::element_type>(lhs) < weak_ptr<typename T::element_type>(rhs);
93 template<
typename T>
struct owner_less;
96 struct owner_less<shared_ptr<T> >:
97 public detail::generic_owner_less<shared_ptr<T>, weak_ptr<T> >
101 struct owner_less<weak_ptr<T> >:
102 public detail::generic_owner_less<weak_ptr<T>, shared_ptr<T> >
111 using boost::shared_ptr;
112 using boost::weak_ptr;
113 using boost::static_pointer_cast;
114 using boost::const_pointer_cast;
115 using boost::dynamic_pointer_cast;
116 using boost::enable_shared_from_this;
117 using boost::make_shared;
118 using boost::owner_less;
122 # error A shared_ptr implementation is not available 125 #endif // OME_COMPAT_MEMORY_H