mirror of
https://github.com/boostorg/intrusive.git
synced 2025-05-09 23:03:56 +00:00
Header dependency cleanup. Removed some standard includes, splitted large "utilities" headers, and minimized algorithm dependencies.
This commit is contained in:
parent
d8d034661a
commit
7ae11c3444
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -9,7 +9,7 @@
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
//[doc_erasing_and_disposing
|
||||
#include <boost/intrusive/list.hpp>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -17,6 +17,7 @@
|
||||
#include <boost/intrusive/avltree.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Daniel K. O. 2005.
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -20,10 +20,9 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
@ -81,7 +80,8 @@ struct avltree_node_checker
|
||||
(height_diff == 0 && node_traits::get_balance(p) == node_traits::zero()) ||
|
||||
(height_diff == 1 && node_traits::get_balance(p) == node_traits::positive())
|
||||
);
|
||||
check_return.height = 1 + std::max(check_return_left.height, check_return_right.height);
|
||||
check_return.height = 1 +
|
||||
(check_return_left.height > check_return_right.height ? check_return_left.height : check_return_right.height);
|
||||
base_checker_t::operator()(p, check_return_left, check_return_right, check_return);
|
||||
}
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2013-2013
|
||||
// (C) Copyright Ion Gaztanaga 2013-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -18,6 +18,7 @@
|
||||
#include <boost/intrusive/bstree.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2013-2013
|
||||
// (C) Copyright Ion Gaztanaga 2013-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -17,7 +17,6 @@
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
@ -30,6 +29,8 @@
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/function_detector.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/default_header_holder.hpp>
|
||||
#include <boost/intrusive/detail/reverse_iterator.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
@ -1456,7 +1457,9 @@ class bstree_impl
|
||||
size_type count(const KeyType &key, KeyValueCompare comp) const
|
||||
{
|
||||
std::pair<const_iterator, const_iterator> ret = this->equal_range(key, comp);
|
||||
return size_type(std::distance(ret.first, ret.second));
|
||||
size_type n = 0;
|
||||
for(; ret.first != ret.second; ++ret.first){ ++n; }
|
||||
return n;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
@ -1470,7 +1473,9 @@ class bstree_impl
|
||||
size_type count(const KeyType &key, KeyValueCompare comp)
|
||||
{
|
||||
std::pair<const_iterator, const_iterator> ret = this->equal_range(key, comp);
|
||||
return size_type(std::distance(ret.first, ret.second));
|
||||
size_type n = 0;
|
||||
for(; ret.first != ret.second; ++ret.first){ ++n; }
|
||||
return n;
|
||||
}
|
||||
|
||||
#else //defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -13,12 +13,15 @@
|
||||
#ifndef BOOST_INTRUSIVE_BSTREE_ALGORITHMS_HPP
|
||||
#define BOOST_INTRUSIVE_BSTREE_ALGORITHMS_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/detail/uncast.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/math.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -16,7 +16,8 @@
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
@ -401,6 +402,24 @@ class circular_list_algorithms
|
||||
link_after(last, p);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: f and l must be in a circular list.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns the number of nodes in the range [f, l).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
static std::size_t distance(const const_node_ptr &f, const const_node_ptr &l)
|
||||
{
|
||||
const_node_ptr i(f);
|
||||
std::size_t result = 0;
|
||||
while(i != l){
|
||||
i = NodeTraits::get_next(i);
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
struct stable_partition_info
|
||||
{
|
||||
std::size_t num_1st_partition;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -14,12 +14,13 @@
|
||||
#ifndef BOOST_INTRUSIVE_CIRCULAR_SLIST_ALGORITHMS_HPP
|
||||
#define BOOST_INTRUSIVE_CIRCULAR_SLIST_ALGORITHMS_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/common_slist_algorithms.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
46
include/boost/intrusive/detail/algo_type.hpp
Normal file
46
include/boost/intrusive/detail/algo_type.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014
|
||||
//
|
||||
// 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_DETAIL_ALGO_TYPE_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_ALGO_TYPE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
enum algo_types
|
||||
{
|
||||
CircularListAlgorithms,
|
||||
CircularSListAlgorithms,
|
||||
LinearSListAlgorithms,
|
||||
CommonSListAlgorithms,
|
||||
BsTreeAlgorithms,
|
||||
RbTreeAlgorithms,
|
||||
AvlTreeAlgorithms,
|
||||
SgTreeAlgorithms,
|
||||
SplayTreeAlgorithms,
|
||||
TreapAlgorithms
|
||||
};
|
||||
|
||||
template<algo_types AlgoType, class NodeTraits>
|
||||
struct get_algo;
|
||||
|
||||
template<algo_types AlgoType, class ValueTraits, class NodePtrCompare, class ExtraChecker>
|
||||
struct get_node_checker;
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_ALGO_TYPE_HPP
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -14,7 +14,6 @@
|
||||
#define BOOST_INTRUSIVE_ANY_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <cstddef>
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -16,7 +16,8 @@
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
@ -151,6 +152,24 @@ class common_slist_algorithms
|
||||
info.beg_2st_partition = new_f;
|
||||
info.new_last_node = bcur;
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: f and l must be in a circular list.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns the number of nodes in the range [f, l).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
static std::size_t distance(const const_node_ptr &f, const const_node_ptr &l)
|
||||
{
|
||||
const_node_ptr i(f);
|
||||
std::size_t result = 0;
|
||||
while(i != l){
|
||||
i = NodeTraits::get_next(i);
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
78
include/boost/intrusive/detail/default_header_holder.hpp
Normal file
78
include/boost/intrusive/detail/default_header_holder.hpp
Normal file
@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014
|
||||
//
|
||||
// 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_DETAIL_DEFAULT_HEADER_HOLDER_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_DEFAULT_HEADER_HOLDER_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
|
||||
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/intrusive/detail/memory_util.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <cstddef>
|
||||
#include <climits>
|
||||
#include <iterator>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
// trivial header node holder
|
||||
template < typename NodeTraits >
|
||||
struct default_header_holder : public NodeTraits::node
|
||||
{
|
||||
typedef NodeTraits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||
|
||||
default_header_holder() : node() {}
|
||||
|
||||
const_node_ptr get_node() const
|
||||
{ return pointer_traits< const_node_ptr >::pointer_to(*static_cast< const node* >(this)); }
|
||||
|
||||
node_ptr get_node()
|
||||
{ return pointer_traits< node_ptr >::pointer_to(*static_cast< node* >(this)); }
|
||||
|
||||
// (unsafe) downcast used to implement container-from-iterator
|
||||
static default_header_holder* get_holder(const node_ptr &p)
|
||||
{ return static_cast< default_header_holder* >(boost::intrusive::detail::to_raw_pointer(p)); }
|
||||
};
|
||||
|
||||
// type function producing the header node holder
|
||||
template < typename Value_Traits, typename HeaderHolder >
|
||||
struct get_header_holder_type
|
||||
{
|
||||
typedef HeaderHolder type;
|
||||
};
|
||||
template < typename Value_Traits >
|
||||
struct get_header_holder_type< Value_Traits, void >
|
||||
{
|
||||
typedef default_header_holder< typename Value_Traits::node_traits > type;
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_DEFAULT_HEADER_HOLDER_HPP
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -17,7 +17,6 @@
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/circular_list_algorithms.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/slist.hpp> //make_slist
|
||||
|
271
include/boost/intrusive/detail/math.hpp
Normal file
271
include/boost/intrusive/detail/math.hpp
Normal file
@ -0,0 +1,271 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014
|
||||
//
|
||||
// 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_DETAIL_MATH_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_MATH_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <climits>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
///////////////////////////
|
||||
// floor_log2 Dispatcher
|
||||
////////////////////////////
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
|
||||
}}} //namespace boost::intrusive::detail
|
||||
|
||||
//Use _BitScanReverseXX intrinsics
|
||||
|
||||
#if defined(_M_X64) || defined(_M_AMD64) || defined(_M_IA64) //64 bit target
|
||||
#define BOOST_INTRUSIVE_BSR_INTRINSIC_64_BIT
|
||||
#endif
|
||||
|
||||
#ifndef __INTRIN_H_ // Avoid including any windows system header
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#if defined(BOOST_INTRUSIVE_BSR_INTRINSIC_64_BIT) //64 bit target
|
||||
unsigned char _BitScanReverse64(unsigned long *index, unsigned __int64 mask);
|
||||
#pragma intrinsic(_BitScanReverse64)
|
||||
#else //32 bit target
|
||||
unsigned char _BitScanReverse(unsigned long *index, unsigned long mask);
|
||||
#pragma intrinsic(_BitScanReverse)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif // __INTRIN_H_
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_BSR_INTRINSIC_64_BIT
|
||||
#define BOOST_INTRUSIVE_BSR_INTRINSIC _BitScanReverse64
|
||||
#undef BOOST_INTRUSIVE_BSR_INTRINSIC_64_BIT
|
||||
#else
|
||||
#define BOOST_INTRUSIVE_BSR_INTRINSIC _BitScanReverse
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
inline std::size_t floor_log2 (std::size_t x)
|
||||
{
|
||||
unsigned long log2;
|
||||
BOOST_INTRUSIVE_BSR_INTRINSIC( &log2, (unsigned long)x );
|
||||
return log2;
|
||||
}
|
||||
|
||||
#undef BOOST_INTRUSIVE_BSR_INTRINSIC
|
||||
|
||||
#elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) //GCC >=3.4
|
||||
|
||||
//Compile-time error in case of missing specialization
|
||||
template<class Uint>
|
||||
struct builtin_clz_dispatch;
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
template<>
|
||||
struct builtin_clz_dispatch<unsigned long long>
|
||||
{
|
||||
static unsigned long long call(unsigned long long n)
|
||||
{ return __builtin_clzll(n); }
|
||||
};
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct builtin_clz_dispatch<unsigned long>
|
||||
{
|
||||
static unsigned long call(unsigned long n)
|
||||
{ return __builtin_clzl(n); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct builtin_clz_dispatch<unsigned int>
|
||||
{
|
||||
static unsigned int call(unsigned int n)
|
||||
{ return __builtin_clz(n); }
|
||||
};
|
||||
|
||||
inline std::size_t floor_log2(std::size_t n)
|
||||
{
|
||||
return sizeof(std::size_t)*CHAR_BIT - std::size_t(1) - builtin_clz_dispatch<std::size_t>::call(n);
|
||||
}
|
||||
|
||||
#else //Portable methods
|
||||
|
||||
////////////////////////////
|
||||
// Generic method
|
||||
////////////////////////////
|
||||
|
||||
inline std::size_t floor_log2_get_shift(std::size_t n, true_ )//power of two size_t
|
||||
{ return n >> 1; }
|
||||
|
||||
inline std::size_t floor_log2_get_shift(std::size_t n, false_ )//non-power of two size_t
|
||||
{ return (n >> 1) + ((n & 1u) & (n != 1)); }
|
||||
|
||||
template<std::size_t N>
|
||||
inline std::size_t floor_log2 (std::size_t x, integer<std::size_t, N>)
|
||||
{
|
||||
const std::size_t Bits = N;
|
||||
const bool Size_t_Bits_Power_2= !(Bits & (Bits-1));
|
||||
|
||||
std::size_t n = x;
|
||||
std::size_t log2 = 0;
|
||||
|
||||
std::size_t remaining_bits = Bits;
|
||||
std::size_t shift = floor_log2_get_shift(remaining_bits, bool_<Size_t_Bits_Power_2>());
|
||||
while(shift){
|
||||
std::size_t tmp = n >> shift;
|
||||
if (tmp){
|
||||
log2 += shift, n = tmp;
|
||||
}
|
||||
shift = floor_log2_get_shift(shift, bool_<Size_t_Bits_Power_2>());
|
||||
}
|
||||
|
||||
return log2;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// DeBruijn method
|
||||
////////////////////////////
|
||||
|
||||
//Taken from:
|
||||
//http://stackoverflow.com/questions/11376288/fast-computing-of-log2-for-64-bit-integers
|
||||
//Thanks to Desmond Hume
|
||||
|
||||
inline std::size_t floor_log2 (std::size_t v, integer<std::size_t, 32>)
|
||||
{
|
||||
static const int MultiplyDeBruijnBitPosition[32] =
|
||||
{
|
||||
0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30,
|
||||
8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31
|
||||
};
|
||||
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
|
||||
return MultiplyDeBruijnBitPosition[(std::size_t)(v * 0x07C4ACDDU) >> 27];
|
||||
}
|
||||
|
||||
inline std::size_t floor_log2 (std::size_t v, integer<std::size_t, 64>)
|
||||
{
|
||||
static const std::size_t MultiplyDeBruijnBitPosition[64] = {
|
||||
63, 0, 58, 1, 59, 47, 53, 2,
|
||||
60, 39, 48, 27, 54, 33, 42, 3,
|
||||
61, 51, 37, 40, 49, 18, 28, 20,
|
||||
55, 30, 34, 11, 43, 14, 22, 4,
|
||||
62, 57, 46, 52, 38, 26, 32, 41,
|
||||
50, 36, 17, 19, 29, 10, 13, 21,
|
||||
56, 45, 25, 31, 35, 16, 9, 12,
|
||||
44, 24, 15, 8, 23, 7, 6, 5};
|
||||
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
v |= v >> 32;
|
||||
return MultiplyDeBruijnBitPosition[((std::size_t)((v - (v >> 1))*0x07EDD5E59A4E28C2ULL)) >> 58];
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t floor_log2 (std::size_t x)
|
||||
{
|
||||
const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT;
|
||||
return floor_log2(x, integer<std::size_t, Bits>());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//Thanks to Laurent de Soras in
|
||||
//http://www.flipcode.com/archives/Fast_log_Function.shtml
|
||||
inline float fast_log2 (float val)
|
||||
{
|
||||
union caster_t
|
||||
{
|
||||
unsigned x;
|
||||
float val;
|
||||
} caster;
|
||||
|
||||
caster.val = val;
|
||||
unsigned x = caster.x;
|
||||
const int log_2 = int((x >> 23) & 255) - 128;
|
||||
x &= ~(unsigned(255u) << 23u);
|
||||
x += unsigned(127) << 23u;
|
||||
caster.x = x;
|
||||
val = caster.val;
|
||||
//1+log2(m), m ranging from 1 to 2
|
||||
//3rd degree polynomial keeping first derivate continuity.
|
||||
//For less precision the line can be commented out
|
||||
val = ((-1.f/3.f) * val + 2.f) * val - (2.f/3.f);
|
||||
return val + static_cast<float>(log_2);
|
||||
}
|
||||
|
||||
inline std::size_t ceil_log2 (std::size_t x)
|
||||
{
|
||||
return static_cast<std::size_t>((x & (x-1)) != 0) + floor_log2(x);
|
||||
}
|
||||
|
||||
template<class SizeType, std::size_t N>
|
||||
struct numbits_eq
|
||||
{
|
||||
static const bool value = sizeof(SizeType)*CHAR_BIT == N;
|
||||
};
|
||||
|
||||
template<class SizeType, class Enabler = void >
|
||||
struct sqrt2_pow_max;
|
||||
|
||||
template <class SizeType>
|
||||
struct sqrt2_pow_max<SizeType, typename enable_if< numbits_eq<SizeType, 32> >::type>
|
||||
{
|
||||
static const SizeType value = 0xb504f334;
|
||||
static const std::size_t pow = 31;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_INT64_T
|
||||
|
||||
template <class SizeType>
|
||||
struct sqrt2_pow_max<SizeType, typename enable_if< numbits_eq<SizeType, 64> >::type>
|
||||
{
|
||||
static const SizeType value = 0xb504f333f9de6484ull;
|
||||
static const std::size_t pow = 63;
|
||||
};
|
||||
|
||||
#endif //BOOST_NO_INT64_T
|
||||
|
||||
// Returns floor(pow(sqrt(2), x * 2 + 1)).
|
||||
// Defined for X from 0 up to the number of bits in size_t minus 1.
|
||||
inline std::size_t sqrt2_pow_2xplus1 (std::size_t x)
|
||||
{
|
||||
const std::size_t value = (std::size_t)sqrt2_pow_max<std::size_t>::value;
|
||||
const std::size_t pow = (std::size_t)sqrt2_pow_max<std::size_t>::pow;
|
||||
return (value >> (pow - x)) + 1;
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_MATH_HPP
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2011-2014. 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)
|
||||
//
|
||||
@ -25,6 +25,11 @@
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/preprocessor.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
# include <boost/preprocessor/iteration/local.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
@ -57,46 +62,46 @@ struct LowPriorityConversion
|
||||
};
|
||||
|
||||
// Infrastructure for providing a default type for T::TNAME if absent.
|
||||
#define BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(TNAME) \
|
||||
template <typename T, typename DefaultType> \
|
||||
struct boost_intrusive_default_type_ ## TNAME \
|
||||
{ \
|
||||
template <typename X> \
|
||||
static char test(int, typename X::TNAME*); \
|
||||
\
|
||||
template <typename X> \
|
||||
static int test(...); \
|
||||
\
|
||||
struct DefaultWrap { typedef DefaultType TNAME; }; \
|
||||
\
|
||||
static const bool value = (1 == sizeof(test<T>(0, 0))); \
|
||||
\
|
||||
typedef typename \
|
||||
::boost::intrusive::detail::if_c \
|
||||
<value, T, DefaultWrap>::type::TNAME type; \
|
||||
}; \
|
||||
\
|
||||
template <typename T, typename DefaultType> \
|
||||
struct boost_intrusive_eval_default_type_ ## TNAME \
|
||||
{ \
|
||||
template <typename X> \
|
||||
static char test(int, typename X::TNAME*); \
|
||||
\
|
||||
template <typename X> \
|
||||
static int test(...); \
|
||||
\
|
||||
struct DefaultWrap \
|
||||
{ typedef typename DefaultType::type TNAME; }; \
|
||||
\
|
||||
static const bool value = (1 == sizeof(test<T>(0, 0))); \
|
||||
\
|
||||
typedef typename \
|
||||
::boost::intrusive::detail::eval_if_c \
|
||||
< value \
|
||||
, ::boost::intrusive::detail::identity<T> \
|
||||
, ::boost::intrusive::detail::identity<DefaultWrap> \
|
||||
>::type::TNAME type; \
|
||||
}; \
|
||||
#define BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(TNAME) \
|
||||
template <typename T, typename DefaultType> \
|
||||
struct boost_intrusive_default_type_ ## TNAME \
|
||||
{ \
|
||||
template <typename X> \
|
||||
static char test(int, typename X::TNAME*); \
|
||||
\
|
||||
template <typename X> \
|
||||
static int test(...); \
|
||||
\
|
||||
struct DefaultWrap { typedef DefaultType TNAME; }; \
|
||||
\
|
||||
static const bool value = (1 == sizeof(test<T>(0, 0))); \
|
||||
\
|
||||
typedef typename \
|
||||
::boost::intrusive::detail::if_c \
|
||||
<value, T, DefaultWrap>::type::TNAME type; \
|
||||
}; \
|
||||
\
|
||||
template <typename T, typename DefaultType> \
|
||||
struct boost_intrusive_eval_default_type_ ## TNAME \
|
||||
{ \
|
||||
template <typename X> \
|
||||
static char test(int, typename X::TNAME*); \
|
||||
\
|
||||
template <typename X> \
|
||||
static int test(...); \
|
||||
\
|
||||
struct DefaultWrap \
|
||||
{ typedef typename DefaultType::type TNAME; }; \
|
||||
\
|
||||
static const bool value = (1 == sizeof(test<T>(0, 0))); \
|
||||
\
|
||||
typedef typename \
|
||||
::boost::intrusive::detail::eval_if_c \
|
||||
< value \
|
||||
, ::boost::intrusive::detail::identity<T> \
|
||||
, ::boost::intrusive::detail::identity<DefaultWrap> \
|
||||
>::type::TNAME type; \
|
||||
}; \
|
||||
//
|
||||
|
||||
#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#if defined(BOOST_MSVC) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && defined(BOOST_INTEL))
|
||||
#define BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#endif
|
||||
|
||||
@ -35,13 +34,13 @@ inline std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_t
|
||||
union caster_union
|
||||
{
|
||||
const Member Parent::* ptr_to_member;
|
||||
boost::int32_t offset;
|
||||
int offset;
|
||||
} caster;
|
||||
|
||||
//MSVC ABI can use up to 3 int32 to represent pointer to member data
|
||||
//with virtual base classes, in those cases there is no simple to
|
||||
//obtain the address of the parent. So static assert to avoid runtime errors
|
||||
BOOST_STATIC_ASSERT( sizeof(caster) == sizeof(boost::int32_t) );
|
||||
BOOST_STATIC_ASSERT( sizeof(caster) == sizeof(int) );
|
||||
|
||||
caster.ptr_to_member = ptr_to_member;
|
||||
return std::ptrdiff_t(caster.offset);
|
||||
|
@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2008-2014. 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)
|
||||
//
|
||||
@ -18,20 +18,12 @@
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
|
||||
#include <boost/preprocessor/iteration/local.hpp>
|
||||
#include <boost/preprocessor/punctuation/paren_if.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/control/expr_if.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/logical/not.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/arithmetic/add.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
|
||||
|
||||
#define BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS 10
|
||||
|
||||
|
38
include/boost/intrusive/detail/to_raw_pointer.hpp
Normal file
38
include/boost/intrusive/detail/to_raw_pointer.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014
|
||||
//
|
||||
// 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_DETAIL_TO_RAW_POINTER_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_TO_RAW_POINTER_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template <class T>
|
||||
inline T* to_raw_pointer(T* p)
|
||||
{ return p; }
|
||||
|
||||
template <class Pointer>
|
||||
inline typename boost::intrusive::pointer_traits<Pointer>::element_type*
|
||||
to_raw_pointer(const Pointer &p)
|
||||
{ return boost::intrusive::detail::to_raw_pointer(p.operator->()); }
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP
|
47
include/boost/intrusive/detail/uncast.hpp
Normal file
47
include/boost/intrusive/detail/uncast.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// 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_DETAIL_UNCAST_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_UNCAST_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<class ConstNodePtr>
|
||||
struct uncast_types
|
||||
{
|
||||
typedef typename pointer_traits<ConstNodePtr>::element_type element_type;
|
||||
typedef typename remove_const<element_type>::type non_const_type;
|
||||
typedef typename pointer_traits<ConstNodePtr>::
|
||||
template rebind_pointer<non_const_type>::type non_const_pointer;
|
||||
typedef pointer_traits<non_const_pointer> non_const_traits;
|
||||
};
|
||||
|
||||
template<class ConstNodePtr>
|
||||
static typename uncast_types<ConstNodePtr>::non_const_pointer
|
||||
uncast(const ConstNodePtr & ptr)
|
||||
{
|
||||
return uncast_types<ConstNodePtr>::non_const_traits::const_cast_from(ptr);
|
||||
}
|
||||
|
||||
} //namespace detail {
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -22,40 +22,21 @@
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/intrusive/detail/memory_util.hpp>
|
||||
#include <boost/intrusive/detail/reverse_iterator.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/intrusive/detail/to_raw_pointer.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <climits>
|
||||
#include <iterator>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
#include <functional>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
struct hash;
|
||||
|
||||
namespace intrusive {
|
||||
|
||||
enum algo_types
|
||||
{
|
||||
CircularListAlgorithms,
|
||||
CircularSListAlgorithms,
|
||||
LinearSListAlgorithms,
|
||||
CommonSListAlgorithms,
|
||||
BsTreeAlgorithms,
|
||||
RbTreeAlgorithms,
|
||||
AvlTreeAlgorithms,
|
||||
SgTreeAlgorithms,
|
||||
SplayTreeAlgorithms,
|
||||
TreapAlgorithms
|
||||
};
|
||||
|
||||
template<algo_types AlgoType, class NodeTraits>
|
||||
struct get_algo;
|
||||
|
||||
template<algo_types AlgoType, class ValueTraits, class NodePtrCompare, class ExtraChecker>
|
||||
struct get_node_checker;
|
||||
|
||||
template <link_mode_type link_mode>
|
||||
struct is_safe_autounlink
|
||||
{
|
||||
@ -96,15 +77,6 @@ BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_base_hook, hooktags::is_ba
|
||||
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_any_hook, is_any_hook)
|
||||
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(resizable, resizable)
|
||||
|
||||
template <class T>
|
||||
inline T* to_raw_pointer(T* p)
|
||||
{ return p; }
|
||||
|
||||
template <class Pointer>
|
||||
inline typename boost::intrusive::pointer_traits<Pointer>::element_type*
|
||||
to_raw_pointer(const Pointer &p)
|
||||
{ return boost::intrusive::detail::to_raw_pointer(p.operator->()); }
|
||||
|
||||
//This functor compares a stored value
|
||||
//and the one passed as an argument
|
||||
template<class ConstReference>
|
||||
@ -394,246 +366,6 @@ template<class Hook>
|
||||
void destructor_impl(Hook &, detail::link_dispatch<normal_link>)
|
||||
{}
|
||||
|
||||
///////////////////////////
|
||||
// floor_log2 Dispatcher
|
||||
////////////////////////////
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
|
||||
}}} //namespace boost::intrusive::detail
|
||||
|
||||
//Use _BitScanReverseXX intrinsics
|
||||
|
||||
#if defined(_M_X64) || defined(_M_AMD64) || defined(_M_IA64) //64 bit target
|
||||
#define BOOST_INTRUSIVE_BSR_INTRINSIC_64_BIT
|
||||
#endif
|
||||
|
||||
#ifndef __INTRIN_H_ // Avoid including any windows system header
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#if defined(BOOST_INTRUSIVE_BSR_INTRINSIC_64_BIT) //64 bit target
|
||||
unsigned char _BitScanReverse64(unsigned long *index, unsigned __int64 mask);
|
||||
#pragma intrinsic(_BitScanReverse64)
|
||||
#else //32 bit target
|
||||
unsigned char _BitScanReverse(unsigned long *index, unsigned long mask);
|
||||
#pragma intrinsic(_BitScanReverse)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif // __INTRIN_H_
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_BSR_INTRINSIC_64_BIT
|
||||
#define BOOST_INTRUSIVE_BSR_INTRINSIC _BitScanReverse64
|
||||
#undef BOOST_INTRUSIVE_BSR_INTRINSIC_64_BIT
|
||||
#else
|
||||
#define BOOST_INTRUSIVE_BSR_INTRINSIC _BitScanReverse
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
inline std::size_t floor_log2 (std::size_t x)
|
||||
{
|
||||
unsigned long log2;
|
||||
BOOST_INTRUSIVE_BSR_INTRINSIC( &log2, (unsigned long)x );
|
||||
return log2;
|
||||
}
|
||||
|
||||
#undef BOOST_INTRUSIVE_BSR_INTRINSIC
|
||||
|
||||
#elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) //GCC >=3.4
|
||||
|
||||
//Compile-time error in case of missing specialization
|
||||
template<class Uint>
|
||||
struct builtin_clz_dispatch;
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
template<>
|
||||
struct builtin_clz_dispatch<unsigned long long>
|
||||
{
|
||||
static unsigned long long call(unsigned long long n)
|
||||
{ return __builtin_clzll(n); }
|
||||
};
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct builtin_clz_dispatch<unsigned long>
|
||||
{
|
||||
static unsigned long call(unsigned long n)
|
||||
{ return __builtin_clzl(n); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct builtin_clz_dispatch<unsigned int>
|
||||
{
|
||||
static unsigned int call(unsigned int n)
|
||||
{ return __builtin_clz(n); }
|
||||
};
|
||||
|
||||
inline std::size_t floor_log2(std::size_t n)
|
||||
{
|
||||
return sizeof(std::size_t)*CHAR_BIT - std::size_t(1) - builtin_clz_dispatch<std::size_t>::call(n);
|
||||
}
|
||||
|
||||
#else //Portable methods
|
||||
|
||||
////////////////////////////
|
||||
// Generic method
|
||||
////////////////////////////
|
||||
|
||||
inline std::size_t floor_log2_get_shift(std::size_t n, true_ )//power of two size_t
|
||||
{ return n >> 1; }
|
||||
|
||||
inline std::size_t floor_log2_get_shift(std::size_t n, false_ )//non-power of two size_t
|
||||
{ return (n >> 1) + ((n & 1u) & (n != 1)); }
|
||||
|
||||
template<std::size_t N>
|
||||
inline std::size_t floor_log2 (std::size_t x, integer<std::size_t, N>)
|
||||
{
|
||||
const std::size_t Bits = N;
|
||||
const bool Size_t_Bits_Power_2= !(Bits & (Bits-1));
|
||||
|
||||
std::size_t n = x;
|
||||
std::size_t log2 = 0;
|
||||
|
||||
std::size_t remaining_bits = Bits;
|
||||
std::size_t shift = floor_log2_get_shift(remaining_bits, bool_<Size_t_Bits_Power_2>());
|
||||
while(shift){
|
||||
std::size_t tmp = n >> shift;
|
||||
if (tmp){
|
||||
log2 += shift, n = tmp;
|
||||
}
|
||||
shift = floor_log2_get_shift(shift, bool_<Size_t_Bits_Power_2>());
|
||||
}
|
||||
|
||||
return log2;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// DeBruijn method
|
||||
////////////////////////////
|
||||
|
||||
//Taken from:
|
||||
//http://stackoverflow.com/questions/11376288/fast-computing-of-log2-for-64-bit-integers
|
||||
//Thanks to Desmond Hume
|
||||
|
||||
inline std::size_t floor_log2 (std::size_t v, integer<std::size_t, 32>)
|
||||
{
|
||||
static const int MultiplyDeBruijnBitPosition[32] =
|
||||
{
|
||||
0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30,
|
||||
8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31
|
||||
};
|
||||
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
|
||||
return MultiplyDeBruijnBitPosition[(std::size_t)(v * 0x07C4ACDDU) >> 27];
|
||||
}
|
||||
|
||||
inline std::size_t floor_log2 (std::size_t v, integer<std::size_t, 64>)
|
||||
{
|
||||
static const std::size_t MultiplyDeBruijnBitPosition[64] = {
|
||||
63, 0, 58, 1, 59, 47, 53, 2,
|
||||
60, 39, 48, 27, 54, 33, 42, 3,
|
||||
61, 51, 37, 40, 49, 18, 28, 20,
|
||||
55, 30, 34, 11, 43, 14, 22, 4,
|
||||
62, 57, 46, 52, 38, 26, 32, 41,
|
||||
50, 36, 17, 19, 29, 10, 13, 21,
|
||||
56, 45, 25, 31, 35, 16, 9, 12,
|
||||
44, 24, 15, 8, 23, 7, 6, 5};
|
||||
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
v |= v >> 32;
|
||||
return MultiplyDeBruijnBitPosition[((std::size_t)((v - (v >> 1))*0x07EDD5E59A4E28C2ULL)) >> 58];
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t floor_log2 (std::size_t x)
|
||||
{
|
||||
const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT;
|
||||
return floor_log2(x, integer<std::size_t, Bits>());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//Thanks to Laurent de Soras in
|
||||
//http://www.flipcode.com/archives/Fast_log_Function.shtml
|
||||
inline float fast_log2 (float val)
|
||||
{
|
||||
union caster_t
|
||||
{
|
||||
boost::uint32_t x;
|
||||
float val;
|
||||
} caster;
|
||||
|
||||
caster.val = val;
|
||||
boost::uint32_t x = caster.x;
|
||||
const int log_2 = int((x >> 23) & 255) - 128;
|
||||
x &= ~(boost::uint32_t(255u) << 23u);
|
||||
x += boost::uint32_t(127) << 23u;
|
||||
caster.x = x;
|
||||
val = caster.val;
|
||||
//1+log2(m), m ranging from 1 to 2
|
||||
//3rd degree polynomial keeping first derivate continuity.
|
||||
//For less precision the line can be commented out
|
||||
val = ((-1.f/3.f) * val + 2.f) * val - (2.f/3.f);
|
||||
return val + static_cast<float>(log_2);
|
||||
}
|
||||
|
||||
inline std::size_t ceil_log2 (std::size_t x)
|
||||
{
|
||||
return static_cast<std::size_t>((x & (x-1)) != 0) + floor_log2(x);
|
||||
}
|
||||
|
||||
template<class SizeType, std::size_t N>
|
||||
struct numbits_eq
|
||||
{
|
||||
static const bool value = sizeof(SizeType)*CHAR_BIT == N;
|
||||
};
|
||||
|
||||
template<class SizeType, class Enabler = void >
|
||||
struct sqrt2_pow_max;
|
||||
|
||||
template <class SizeType>
|
||||
struct sqrt2_pow_max<SizeType, typename enable_if< numbits_eq<SizeType, 32> >::type>
|
||||
{
|
||||
static const boost::uint32_t value = 0xb504f334;
|
||||
static const std::size_t pow = 31;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_INT64_T
|
||||
|
||||
template <class SizeType>
|
||||
struct sqrt2_pow_max<SizeType, typename enable_if< numbits_eq<SizeType, 64> >::type>
|
||||
{
|
||||
static const boost::uint64_t value = 0xb504f333f9de6484ull;
|
||||
static const std::size_t pow = 63;
|
||||
};
|
||||
|
||||
#endif //BOOST_NO_INT64_T
|
||||
|
||||
// Returns floor(pow(sqrt(2), x * 2 + 1)).
|
||||
// Defined for X from 0 up to the number of bits in size_t minus 1.
|
||||
inline std::size_t sqrt2_pow_2xplus1 (std::size_t x)
|
||||
{
|
||||
const std::size_t value = (std::size_t)sqrt2_pow_max<std::size_t>::value;
|
||||
const std::size_t pow = (std::size_t)sqrt2_pow_max<std::size_t>::pow;
|
||||
return (value >> (pow - x)) + 1;
|
||||
}
|
||||
|
||||
template<class Container, class Disposer>
|
||||
class exception_disposer
|
||||
{
|
||||
@ -797,57 +529,6 @@ class array_initializer
|
||||
private:
|
||||
detail::max_align rawbuf[(N*sizeof(T)-1)/sizeof(detail::max_align)+1];
|
||||
};
|
||||
|
||||
template<class ConstNodePtr>
|
||||
struct uncast_types
|
||||
{
|
||||
typedef typename pointer_traits<ConstNodePtr>::element_type element_type;
|
||||
typedef typename remove_const<element_type>::type non_const_type;
|
||||
typedef typename pointer_traits<ConstNodePtr>::
|
||||
template rebind_pointer<non_const_type>::type non_const_pointer;
|
||||
typedef pointer_traits<non_const_pointer> non_const_traits;
|
||||
};
|
||||
|
||||
template<class ConstNodePtr>
|
||||
static typename uncast_types<ConstNodePtr>::non_const_pointer
|
||||
uncast(const ConstNodePtr & ptr)
|
||||
{
|
||||
return uncast_types<ConstNodePtr>::non_const_traits::const_cast_from(ptr);
|
||||
}
|
||||
|
||||
// trivial header node holder
|
||||
template < typename NodeTraits >
|
||||
struct default_header_holder : public NodeTraits::node
|
||||
{
|
||||
typedef NodeTraits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||
|
||||
default_header_holder() : node() {}
|
||||
|
||||
const_node_ptr get_node() const
|
||||
{ return pointer_traits< const_node_ptr >::pointer_to(*static_cast< const node* >(this)); }
|
||||
|
||||
node_ptr get_node()
|
||||
{ return pointer_traits< node_ptr >::pointer_to(*static_cast< node* >(this)); }
|
||||
|
||||
// (unsafe) downcast used to implement container-from-iterator
|
||||
static default_header_holder* get_holder(const node_ptr &p)
|
||||
{ return static_cast< default_header_holder* >(boost::intrusive::detail::to_raw_pointer(p)); }
|
||||
};
|
||||
|
||||
// type function producing the header node holder
|
||||
template < typename Value_Traits, typename HeaderHolder >
|
||||
struct get_header_holder_type
|
||||
{
|
||||
typedef HeaderHolder type;
|
||||
};
|
||||
template < typename Value_Traits >
|
||||
struct get_header_holder_type< Value_Traits, void >
|
||||
{
|
||||
typedef default_header_holder< typename Value_Traits::node_traits > type;
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
|
||||
|
@ -3000,7 +3000,9 @@ class hashtable_impl
|
||||
to_return.second = bucket_type::s_iterator_to
|
||||
(*node_traits::get_next(group_functions_t::get_last_in_group
|
||||
(detail::dcast_bucket_ptr<node>(it.pointed_node()), optimize_multikey_t())));
|
||||
cnt = std::distance(it, to_return.second);
|
||||
|
||||
cnt = 0;
|
||||
for(; it != to_return.second; ++it){ ++cnt; }
|
||||
if(to_return.second != b.end()){
|
||||
bucket_number_second = bucket_number_first;
|
||||
return to_return;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -17,7 +17,7 @@
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/common_slist_algorithms.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -26,7 +26,9 @@
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/default_header_holder.hpp>
|
||||
#include <boost/intrusive/detail/reverse_iterator.hpp>
|
||||
#include <boost/intrusive/detail/uncast.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cstddef>
|
||||
@ -597,9 +599,9 @@ class list_impl
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
|
||||
//! erased elements.
|
||||
iterator erase(const_iterator b, const_iterator e, difference_type n)
|
||||
iterator erase(const_iterator b, const_iterator e, size_type n)
|
||||
{
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(b, e) == difference_type(n));
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(node_algorithms::distance(b.pointed_node(), e.pointed_node()) == n);
|
||||
if(safemode_or_autounlink || constant_time_size){
|
||||
return this->erase_and_dispose(b, e, detail::null_disposer());
|
||||
}
|
||||
@ -891,7 +893,7 @@ class list_impl
|
||||
void splice(const_iterator p, list_impl&x, const_iterator f, const_iterator e)
|
||||
{
|
||||
if(constant_time_size)
|
||||
this->splice(p, x, f, e, std::distance(f, e));
|
||||
this->splice(p, x, f, e, node_algorithms::distance(f.pointed_node(), e.pointed_node()));
|
||||
else
|
||||
this->splice(p, x, f, e, 1);//distance is a dummy value
|
||||
}
|
||||
@ -909,11 +911,11 @@ class list_impl
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice(const_iterator p, list_impl&x, const_iterator f, const_iterator e, difference_type n)
|
||||
void splice(const_iterator p, list_impl&x, const_iterator f, const_iterator e, size_type n)
|
||||
{
|
||||
if(n){
|
||||
if(constant_time_size){
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(n == std::distance(f, e));
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(n == node_algorithms::distance(f.pointed_node(), e.pointed_node()));
|
||||
node_algorithms::transfer(p.pointed_node(), f.pointed_node(), e.pointed_node());
|
||||
size_traits &thist = this->priv_size_traits();
|
||||
size_traits &xt = x.priv_size_traits();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -24,7 +24,6 @@
|
||||
#include <boost/intrusive/detail/rbtree_node.hpp>
|
||||
#include <boost/intrusive/bstree.hpp>
|
||||
#include <boost/intrusive/detail/tree_node.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/function_detector.hpp>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -29,9 +29,9 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -18,8 +18,10 @@
|
||||
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/rbtree.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -16,9 +16,12 @@
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/sgtree.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -32,10 +32,10 @@
|
||||
#include <boost/intrusive/bs_set_hook.hpp>
|
||||
#include <boost/intrusive/bstree.hpp>
|
||||
#include <boost/intrusive/detail/tree_node.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/math.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/sgtree_algorithms.hpp>
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -22,9 +22,9 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
|
||||
|
||||
namespace boost {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -25,8 +25,9 @@
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/default_header_holder.hpp>
|
||||
#include <boost/intrusive/detail/uncast.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <cstddef> //std::size_t
|
||||
@ -900,7 +901,7 @@ class slist_impl
|
||||
//! erased element.
|
||||
iterator erase_after(const_iterator before_f, const_iterator l, size_type n)
|
||||
{
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(++const_iterator(before_f), l) == difference_type(n));
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(node_algorithms::distance((++const_iterator(before_f)).pointed_node(), l.pointed_node()) == n);
|
||||
if(safemode_or_autounlink){
|
||||
return this->erase_after(before_f, l);
|
||||
}
|
||||
@ -1234,7 +1235,7 @@ class slist_impl
|
||||
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l)
|
||||
{
|
||||
if(constant_time_size)
|
||||
this->splice_after(prev_pos, x, before_f, before_l, std::distance(before_f, before_l));
|
||||
this->splice_after(prev_pos, x, before_f, before_l, node_algorithms::distance(before_f.pointed_node(), before_l.pointed_node()));
|
||||
else
|
||||
this->priv_splice_after
|
||||
(prev_pos.pointed_node(), x, before_f.pointed_node(), before_l.pointed_node());
|
||||
@ -1256,7 +1257,7 @@ class slist_impl
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l, size_type n)
|
||||
{
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(before_f, before_l) == difference_type(n));
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(node_algorithms::distance(before_f.pointed_node(), before_l.pointed_node()) == n);
|
||||
this->priv_splice_after
|
||||
(prev_pos.pointed_node(), x, before_f.pointed_node(), before_l.pointed_node());
|
||||
if(constant_time_size){
|
||||
@ -1799,7 +1800,7 @@ class slist_impl
|
||||
void incorporate_after(const_iterator prev_pos, const node_ptr & f, const node_ptr & before_l)
|
||||
{
|
||||
if(constant_time_size)
|
||||
this->incorporate_after(prev_pos, f, before_l, std::distance(f, before_l)+1);
|
||||
this->incorporate_after(prev_pos, f, before_l, node_algorithms::distance(f.pointed_node(), before_l.pointed_node())+1);
|
||||
else
|
||||
this->priv_incorporate_after(prev_pos.pointed_node(), f, before_l);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -17,6 +17,8 @@
|
||||
#include <boost/intrusive/splaytree.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -23,7 +23,6 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/intrusive/bstree.hpp>
|
||||
#include <boost/intrusive/detail/tree_node.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/function_detector.hpp>
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -33,9 +33,9 @@
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/intrusive/detail/uncast.hpp>
|
||||
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -19,8 +19,7 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -17,6 +17,8 @@
|
||||
#include <boost/intrusive/treap.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -17,6 +17,8 @@
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/hashtable.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
|
||||
|
@ -226,6 +226,9 @@
|
||||
<Filter
|
||||
Name="detail"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\algo_type.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\any_node_and_algorithms.hpp">
|
||||
</File>
|
||||
@ -241,6 +244,9 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\config_end.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\default_header_holder.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\ebo_functor_holder.hpp">
|
||||
</File>
|
||||
@ -265,6 +271,9 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\list_node.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\math.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\memory_util.hpp">
|
||||
</File>
|
||||
@ -283,12 +292,18 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\slist_node.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\to_raw_pointer.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\transform_iterator.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\tree_node.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\uncast.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\utilities.hpp">
|
||||
</File>
|
||||
|
Loading…
x
Reference in New Issue
Block a user