forked from boostorg/intrusive
Added avl trees
[SVN r40598]
This commit is contained in:
1 parent
5d9b85323a
commit
ab9959fc4e
13 files changed
+1628
-20
No files matched your search
@@ -12,6 +12,8 @@
|
||||
#define BOOST_INTRUSIVE_SMART_PTR_HPP
|
||||
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/intrusive/pointer_plus_bit.hpp>
|
||||
#include <boost/intrusive/pointer_plus_2_bits.hpp>
|
||||
|
||||
#if (defined _MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
@@ -343,4 +345,78 @@ inline smart_ptr<T>
|
||||
} //namespace intrusive {
|
||||
} //namespace boost {
|
||||
|
||||
namespace boost{
|
||||
|
||||
//This is to support embedding a bit in the pointer
|
||||
//for intrusive containers, saving space
|
||||
namespace intrusive {
|
||||
|
||||
template<std::size_t N>
|
||||
struct has_pointer_plus_bit<smart_ptr<void>, N>
|
||||
{
|
||||
static const bool value = has_pointer_plus_bit<void*, N>::value;
|
||||
};
|
||||
|
||||
//Specialization
|
||||
template<class T>
|
||||
struct pointer_plus_bit<smart_ptr<T> >
|
||||
{
|
||||
typedef smart_ptr<T> pointer;
|
||||
|
||||
static pointer get_pointer(const pointer &n)
|
||||
{ return pointer_plus_bit<T*>::get_pointer(n.get()); }
|
||||
|
||||
static void set_pointer(pointer &n, pointer p)
|
||||
{
|
||||
T *raw_n = n.get();
|
||||
pointer_plus_bit<T*>::set_pointer(raw_n, p.get());
|
||||
n = raw_n;
|
||||
}
|
||||
|
||||
static bool get_bit(const pointer &n)
|
||||
{ return pointer_plus_bit<T*>::get_bit(n.get()); }
|
||||
|
||||
static void set_bit(pointer &n, bool c)
|
||||
{
|
||||
T *raw_n = n.get();
|
||||
pointer_plus_bit<T*>::set_bit(raw_n, c);
|
||||
n = raw_n;
|
||||
}
|
||||
};
|
||||
|
||||
template<std::size_t N>
|
||||
struct has_pointer_plus_2_bits<smart_ptr<void>, N>
|
||||
{
|
||||
static const bool value = has_pointer_plus_2_bits<void*, N>::value;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct pointer_plus_2_bits<smart_ptr<T> >
|
||||
{
|
||||
typedef smart_ptr<T> pointer;
|
||||
|
||||
static pointer get_pointer(const pointer &n)
|
||||
{ return pointer_plus_2_bits<T*>::get_pointer(n.get()); }
|
||||
|
||||
static void set_pointer(pointer &n, pointer p)
|
||||
{
|
||||
T *raw_n = n.get();
|
||||
pointer_plus_2_bits<T*>::set_pointer(raw_n, p.get());
|
||||
n = raw_n;
|
||||
}
|
||||
|
||||
static std::size_t get_bits(const pointer &n)
|
||||
{ return pointer_plus_2_bits<T*>::get_bits(n.get()); }
|
||||
|
||||
static void set_bits(pointer &n, std::size_t c)
|
||||
{
|
||||
T *raw_n = n.get();
|
||||
pointer_plus_2_bits<T*>::set_bits(raw_n, c);
|
||||
n = raw_n;
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost{
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_SMART_PTR_HPP
|
||||
Reference in new issue
Block a user