27#ifndef TREEDEC_BUCKET_SORTER_HPP
28#define TREEDEC_BUCKET_SORTER_HPP
31#define BOOST_GRAPH_DETAIL_BUCKET_SORTER_HPP
38#if defined(BOOST_CLANG) && (1 == BOOST_CLANG) && defined(__FreeBSD__)
39#define ITERATOR_CONSTRUCTOR_WORKAROUND
44 template <
class BucketType,
class ValueType,
class Bucket,
52 typedef typename std::vector<value_type>::size_type
size_type;
55 const Bucket& _bucket = Bucket(),
56 const ValueIndexMap& _id = ValueIndexMap())
70 for(; l < _length + _max_bucket; ++l){
82 std::cerr <<
"rm " << i <<
"\n";
83 std::cerr <<
"rm " << x <<
" " << i <<
" " <<
bucket[x] <<
"\n";
85 std::cerr <<
"rm " <<
prev[i] <<
" " <<
next[i] <<
"\n";
87 auto next_node =
next[i];
88 auto prev_node =
prev[i];
91 prev[next_node] = prev_node;
92 next[prev_node] = next_node;
97 assert(x<
next.size());
99 (*this)[
bucket[x]].push_back(x);
104 assert(x<
next.size());
106 (*this)[
bucket[x]].push_front(x);
117 (*this)[
bucket[x]].push(x);
126 (*this)[
bucket[x]].push_back(x);
133 return (std::numeric_limits<size_type>::max)();
136 typedef typename std::vector<size_type>::iterator
Iter;
137 typedef typename std::vector<size_type>::const_iterator
ConstIter;
143 template<
class Iter_,
class IndexValueMap_>
217 const ValueIndexMap& _id)
218#ifdef ITERATOR_CONSTRUCTOR_WORKAROUND
231#ifdef ITERATOR_CONSTRUCTOR_WORKAROUND
243 assert(new_head <
size());
245 if(new_head == current){
untested();
249 assert(current!=new_head);
250 prev[current] = new_head;
256 next[new_head] = current;
261 assert(new_tail <
size());
264 if(new_tail == current){
untested();
268 assert(current!=new_tail);
269 next[current] = new_tail;
274 prev[new_tail] = current;
330 assert(i <
next.size());
335 assert(i <
next.size());
344 typename std::vector<size_type>::iterator
head;
345 typename std::vector<size_type>::iterator
tail;
Definition bucket_sorter.hpp:149
bool operator==(const_iterator const &o)
Definition bucket_sorter.hpp:186
const_iterator(const const_iterator &p)
Definition bucket_sorter.hpp:155
const_iterator()
Definition bucket_sorter.hpp:151
bool operator!=(const_iterator const &o)
Definition bucket_sorter.hpp:183
const_iterator & operator++()
Definition bucket_sorter.hpp:177
size_type b
Definition bucket_sorter.hpp:190
value_type operator*() const
Definition bucket_sorter.hpp:173
const_iterator(const const_iterator &&p)
Definition bucket_sorter.hpp:157
stack_ const & s
Definition bucket_sorter.hpp:189
const_iterator & operator=(const const_iterator &&o)
Definition bucket_sorter.hpp:167
~const_iterator()
Definition bucket_sorter.hpp:159
const_iterator(size_type t, stack_ const &s_)
Definition bucket_sorter.hpp:153
const_iterator & operator=(const const_iterator &o)
Definition bucket_sorter.hpp:161
Definition bucket_sorter.hpp:144
const_iterator end() const
Definition bucket_sorter.hpp:311
IndexValueMap_ value
Definition bucket_sorter.hpp:322
const_iterator rbegin() const
Definition bucket_sorter.hpp:308
stack_(bucket_type _bucket_id, Iter_ h, Iter_ n, Iter_ p, Iter_ t, IndexValueMap_ v, const ValueIndexMap &_id)
Definition bucket_sorter.hpp:216
void push_back(const value_type &x)
Definition bucket_sorter.hpp:259
value_type const & front() const
Definition bucket_sorter.hpp:298
bool empty() const
Definition bucket_sorter.hpp:300
const_iterator begin() const
Definition bucket_sorter.hpp:304
bucket_type bucket_id
Definition bucket_sorter.hpp:317
value_type & front()
Definition bucket_sorter.hpp:299
value_type const & top() const
Definition bucket_sorter.hpp:296
void push(const value_type &x)
Definition bucket_sorter.hpp:278
size_t size() const
Definition bucket_sorter.hpp:315
stack_(const stack_ &p)
Definition bucket_sorter.hpp:193
ValueIndexMap id
Definition bucket_sorter.hpp:323
bucket_sorter base
Definition bucket_sorter.hpp:146
bucket_sorter::value_type value_type
Definition bucket_sorter.hpp:147
Iter_ next
Definition bucket_sorter.hpp:319
Iter_ head
Definition bucket_sorter.hpp:318
void pop()
Definition bucket_sorter.hpp:281
value_type & top()
Definition bucket_sorter.hpp:297
stack_ & operator=(const stack_ &p)
Definition bucket_sorter.hpp:204
Iter_ prev
Definition bucket_sorter.hpp:320
void push_front(const value_type &x)
Definition bucket_sorter.hpp:241
Iter_ tail
Definition bucket_sorter.hpp:321
stack_(bucket_type _bucket_id, Iter_ h, Iter_ n, Iter_ p, Iter_ t, IndexValueMap_ v)
Definition bucket_sorter.hpp:230
Definition bucket_sorter.hpp:46
std::vector< size_type >::const_iterator ConstIter
Definition bucket_sorter.hpp:137
void update_back(const value_type &x)
Definition bucket_sorter.hpp:122
bucket_sorter()
Definition bucket_sorter.hpp:75
stack_< Iter, IndexValueMap > stack
Definition bucket_sorter.hpp:326
BucketType bucket_type
Definition bucket_sorter.hpp:48
std::vector< value_type >::iterator IndexValueMap
Definition bucket_sorter.hpp:138
ValueType value_type
Definition bucket_sorter.hpp:49
std::vector< value_type >::const_iterator ConstIndexValueMap
Definition bucket_sorter.hpp:139
void push(const value_type &x)
Definition bucket_sorter.hpp:108
std::vector< size_type > prev
Definition bucket_sorter.hpp:343
std::vector< size_type > next
Definition bucket_sorter.hpp:342
bucket_sorter(size_type _length, bucket_type _max_bucket, const Bucket &_bucket=Bucket(), const ValueIndexMap &_id=ValueIndexMap())
Definition bucket_sorter.hpp:54
void push_back(const value_type &x)
Definition bucket_sorter.hpp:96
ValueIndexMap id
Definition bucket_sorter.hpp:348
std::vector< value_type >::size_type size_type
Definition bucket_sorter.hpp:52
const_stack operator[](const bucket_type &i) const
Definition bucket_sorter.hpp:329
size_t size() const
Definition bucket_sorter.hpp:340
void remove(const value_type &x)
Definition bucket_sorter.hpp:78
Bucket Bucket_type
Definition bucket_sorter.hpp:50
void push_front(const value_type &x)
Definition bucket_sorter.hpp:101
stack_< ConstIter, ConstIndexValueMap > const_stack
Definition bucket_sorter.hpp:327
std::vector< value_type > id_to_value
Definition bucket_sorter.hpp:346
stack operator[](const bucket_type &i)
Definition bucket_sorter.hpp:334
std::vector< size_type >::iterator Iter
Definition bucket_sorter.hpp:136
ValueIndexMap value_index_map
Definition bucket_sorter.hpp:51
static size_type invalid_value()
Definition bucket_sorter.hpp:132
void update(const value_type &x)
Definition bucket_sorter.hpp:119
std::vector< size_type >::iterator tail
Definition bucket_sorter.hpp:345
Bucket bucket
Definition bucket_sorter.hpp:347
void update_front(const value_type &x)
Definition bucket_sorter.hpp:113
std::vector< size_type >::iterator head
Definition bucket_sorter.hpp:344
#define untested()
Definition lua_table_handle.cpp:15
Definition boost_serialization_routines.h:49
SM_edge_weight_map< typename T::value_type, ug::BidirectionalMatrix< T > > get(edge_weight_t, ug::BidirectionalMatrix< T > const &g)
Definition bidirectional_boost.h:157
#define unreachable()
Definition trace.h:13
#define itested()
Definition trace.h:9