2007-05-04 21:30:54 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2013-07-28 22:10:37 +00:00
|
|
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
2007-05-04 21:30:54 +00:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
|
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
// See http://www.boost.org/libs/intrusive for documentation.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
|
|
|
|
#define BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
|
|
|
|
|
2007-05-12 12:34:55 +00:00
|
|
|
#include<boost/intrusive/detail/utilities.hpp>
|
2007-09-26 17:39:06 +00:00
|
|
|
#include<boost/intrusive/detail/mpl.hpp>
|
2014-02-15 00:28:41 +01:00
|
|
|
#include<boost/static_assert.hpp>
|
2007-05-12 12:34:55 +00:00
|
|
|
|
2007-05-04 21:30:54 +00:00
|
|
|
namespace boost {
|
|
|
|
namespace intrusive {
|
|
|
|
namespace test {
|
|
|
|
|
2007-09-26 17:39:06 +00:00
|
|
|
template<class T>
|
2007-06-23 13:09:46 +00:00
|
|
|
class delete_disposer
|
2007-05-04 21:30:54 +00:00
|
|
|
{
|
2007-09-26 17:39:06 +00:00
|
|
|
public:
|
2007-05-04 21:30:54 +00:00
|
|
|
template <class Pointer>
|
|
|
|
void operator()(Pointer p)
|
|
|
|
{
|
2007-09-26 17:39:06 +00:00
|
|
|
typedef typename std::iterator_traits<Pointer>::value_type value_type;
|
2014-02-15 00:28:41 +01:00
|
|
|
BOOST_STATIC_ASSERT(( detail::is_same<T, value_type>::value ));
|
2012-05-20 09:54:48 +00:00
|
|
|
delete boost::intrusive::detail::to_raw_pointer(p);
|
2007-05-04 21:30:54 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2007-09-26 17:39:06 +00:00
|
|
|
template<class T>
|
2007-05-04 21:30:54 +00:00
|
|
|
class new_cloner
|
|
|
|
{
|
2007-09-26 17:39:06 +00:00
|
|
|
public:
|
|
|
|
T *operator()(const T &t)
|
|
|
|
{ return new T(t); }
|
2007-05-04 21:30:54 +00:00
|
|
|
};
|
|
|
|
|
2008-06-21 09:06:15 +00:00
|
|
|
template<class T>
|
|
|
|
class new_default_factory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T *operator()()
|
|
|
|
{ return new T(); }
|
|
|
|
};
|
|
|
|
|
2007-05-04 21:30:54 +00:00
|
|
|
} //namespace test {
|
|
|
|
} //namespace intrusive {
|
|
|
|
} //namespace boost {
|
|
|
|
|
|
|
|
#endif
|