26 #ifndef ORDEREDLIST_HPP_
27 #define ORDEREDLIST_HPP_ 1
35 template<
class T,
class Allocator,
class intern_list>
37 template<
class T,
class Allocator,
class intern_list>
54 template <
class T,
class Allocator = std::allocator<T> >
58 typedef std::list<Entry,typename Allocator::template rebind<Entry>::other>
intern_list;
109 typedef typename allocator_type::pointer
pointer;
126 std::size_t
size()
const;
136 template<
class InputIt>
172 template<
class _T,
class _Allocator>
175 template<
class _T,
class _Allocator>
182 template<
class T,
class Allocator>
189 template<
class T,
class Allocator>
192 return !(lhs == rhs);
199 template<
class T,
class Allocator,
class intern_list>
200 class _ordered_iterator :
public std::iterator<std::bidirectional_iterator_tag,T> {
202 typedef typename std::iterator<std::bidirectional_iterator_tag,T>
204 typedef typename std::iterator<std::bidirectional_iterator_tag,T>
236 typename intern_list::iterator
it;
244 template<
class T,
class Allocator,
class intern_list>
247 typedef typename std::iterator<std::bidirectional_iterator_tag,const T>
249 typedef typename std::iterator<std::bidirectional_iterator_tag,const T>
256 intern_list>& other) :
it(other.
it) {}
284 typename intern_list::const_iterator
it;
289 template <
class T,
class Allocator>
296 template <
class T,
class Allocator>
301 template <
class T,
class Allocator>
306 template <
class T,
class Allocator>
308 return list.max_size();
311 template <
class T,
class Allocator>
316 template <
class T,
class Allocator>
319 list.push_front(
Entry(value,0));
322 template <
class T,
class Allocator>
326 typename intern_list::iterator it = list.insert(pos.
it,Entry(value,pos.
it->index));
327 std::for_each(pos.
it,list.end(),IncrementEntry());
331 template <
class T,
class Allocator>
332 template <
class InputIt>
335 InputIt first, InputIt last) {
336 typename intern_list::iterator it = pos.
it;
337 std::for_each(first,last,
Inserter(list,pos.
it));
341 template <
class T,
class Allocator>
345 typename intern_list::iterator it = list.erase(pos.
it);
346 std::for_each(it,list.end(),DecrementEntry());
350 template <
class T,
class Allocator>
351 inline typename ordered_list<T, Allocator>::iterator
353 typename ordered_list<T, Allocator>::iterator first,
354 typename ordered_list<T, Allocator>::iterator last) {
355 std::size_t
index = first.it->index;
356 typename intern_list::iterator it = list.erase(first.it,last.it);
357 std::for_each(it,list.end(),IncreasingEntry(index));
361 template <
class T,
class Allocator>
366 template <
class T,
class Allocator>
372 template <
class T,
class Allocator>
377 template <
class T,
class Allocator>
383 template <
class T,
class Allocator>
386 return list.rbegin();
389 template <
class T,
class Allocator>
395 template <
class T,
class Allocator>
398 return list.rbegin();
401 template <
class T,
class Allocator>
407 template <
class T,
class Allocator>
410 return list.front().value;
412 template <
class T,
class Allocator>
415 return list.back().value;
417 template <
class T,
class Allocator>
420 return list.front().value;
422 template <
class T,
class Allocator>
425 return list.back().value;
427 template <
class T,
class Allocator>
432 template <
class T,
class Allocator>
434 list.swap(other.
list);
439 #endif // ORDEREDLIST_HPP
bool operator==(const Entry &other) const
std::reverse_iterator< const_iterator > const_reverse_iterator
const reference operator*() const
void operator()(Entry &E)
allocator_type::const_reference const_reference
void operator()(Entry &E)
bool empty() const
checks if the container has no elements.
_ordered_const_iterator & operator--()
_ordered_iterator(const _ordered_iterator &other)
friend bool operator==(const ordered_list< _T, _Allocator > &lhs, const ordered_list< _T, _Allocator > &rhs)
const pointer operator->() const
_ordered_const_iterator(const _ordered_iterator< T, Allocator, intern_list > &other)
std::size_t max_size() const
returns the maximum possible number of elements
void clear()
removes all elements from the container
bool operator!=(const _ordered_const_iterator &rhs) const
const_reference back() const
access the last element
_ordered_const_iterator()
std::iterator< std::bidirectional_iterator_tag, const T >::reference reference
allocator_type::const_pointer const_pointer
iterator insert(iterator pos, const T &value)
inserts value before the element pointed to by pos
intern_list::iterator intern_iterator
const pointer operator->() const
Increment function struct.
allocator_type::reference reference
_ordered_const_iterator operator++(int)
iterator begin()
returns an iterator to the beginning
_ordered_const_iterator & operator++()
std::iterator< std::bidirectional_iterator_tag, T >::pointer pointer
intern_list list
internal storage
JNIEnv jthread jobject jclass jlong size
iterator erase(iterator pos)
erases element
_ordered_const_iterator(const _ordered_const_iterator &other)
iterator end()
returns an iterator to the end
_ordered_iterator operator++(int)
intern_list::const_iterator it
_ordered_iterator< T, Allocator, intern_list > iterator
std::iterator< std::bidirectional_iterator_tag, const T >::pointer pointer
Instruction::InstID tmp[]
IncreasingEntry(std::size_t index)
std::size_t size() const
returns the number of elements
bool operator!=(const ordered_list< T, Allocator > &lhs, const ordered_list< T, Allocator > &rhs)
inequality
_ordered_iterator & operator++()
_ordered_const_iterator< T, Allocator, intern_list > const_iterator
bool operator==(const _ordered_const_iterator &rhs) const
const_reference front() const
access the first element
void push_back(const T &value)
Appends the given element value to the end of the container.
reverse_iterator rbegin()
returns a reverse iterator to the beginning
Decrement function struct.
ordered_list & operator=(const ordered_list< T, Allocator > &other)
copy assignment operator
allocator_type::pointer pointer
const reference operator*() const
bool operator==(const ordered_list< T, Allocator > &lhs, const ordered_list< T, Allocator > &rhs)
equality
_ordered_const_iterator(typename intern_list::const_iterator it)
bool operator==(const _ordered_iterator &rhs) const
ordered_list(const ordered_list< T, Allocator > &other)
copy constructor
ordered_list()
construct an empty MachineBasicBlock
std::reverse_iterator< iterator > reverse_iterator
_ordered_const_iterator operator--(int)
void push_front(const T &value)
inserts value to the beginning
bool operator!=(const _ordered_iterator &rhs) const
Entry(T value, std::size_t index)
std::list< Entry, typename Allocator::template rebind< Entry >::other > intern_list
reverse_iterator rend()
returns a reverse iterator to the end
bool operator>(const _ordered_const_iterator &rhs) const
bool operator>(const _ordered_iterator &rhs) const
void swap(ordered_list< T, Allocator > &other)
exchanges the contents of the container with those of other
_ordered_iterator(typename intern_list::iterator it)
void operator()(T &value)
void operator()(Entry &E)
Increasing function struct.
bool operator<(const _ordered_const_iterator &rhs) const
std::iterator< std::bidirectional_iterator_tag, T >::reference reference
Inserter(intern_list &list, intern_iterator pos)
bool operator<(const _ordered_iterator &rhs) const
_ordered_iterator operator--(int)
_ordered_iterator & operator--()
An ordered_list is an indexed sequence container.