Go to the documentation of this file.
38 #ifndef BLOCXX_LIST_HPP_INCLUDE_GUARD_
39 #define BLOCXX_LIST_HPP_INCLUDE_GUARD_
40 #include "blocxx/BLOCXX_config.h"
48 template<
class T>
class List;
51 inline bool operator==(
const List<T>& x,
const List<T>& y);
54 inline bool operator<(
const List<T>& x,
const List<T>& y);
60 template<
class T>
class List
63 typedef std::list<T>
L;
67 typedef typename L::pointer
pointer;
73 typedef typename L::iterator
iterator;
94 template<
class InputIterator>
95 List(InputIterator first, InputIterator last)
116 List(
int n,
const T& value) :
m_impl(new
L(n, value))
126 List(
long n,
const T& value) :
m_impl(new
L(n, value))
236 return m_impl->max_size();
295 return m_impl->insert(position);
304 template<
class InputIterator>
305 void insert(
iterator position, InputIterator first, InputIterator last)
307 m_impl->insert(position, first, last);
320 m_impl->insert(pos, n, x);
333 m_impl->insert(pos, n, x);
346 m_impl->insert(pos, n, x);
375 return m_impl->erase(position);
388 return m_impl->erase(first, last);
398 m_impl->resize(new_size, x);
430 for( ; first !=
end(); ++first)
460 for( ; first !=
end(); ++first)
491 return find(x, first, last) !=
end();
524 m_impl->splice(position, *x.m_impl);
536 m_impl->splice(position, *x.m_impl,
i);
549 m_impl->splice(position, *x.m_impl, first, last);
555 void remove(
const T& value)
594 template<
class Predicate>
void remove_if (Predicate p)
603 template<
class BinaryPredicate>
void unique(BinaryPredicate bp)
645 return *x.m_impl == *y.m_impl;
648 inline bool operator<(
const List<T>& x,
const List<T>& y)
650 return *x.m_impl < *y.m_impl;
660 return new std::list<T>(*obj);
bool operator<(const Array< T > &x, const Array< T > &y)
iterator erase(iterator position)
Remove an element from the List specified with an iterator.
void sort()
Sort the list using the < operator to compare elements.
void splice(iterator position, List &x)
@doctodo Move the specified list into the current list at the given position.
void merge(List &x)
Merge the current and specified lists, producing a combined list that is ordered with respect to the ...
void swap(List< T > &x)
Exchanges the elements of the current list with those of another.
void unique()
Remove all duplicate elements from the List.
void clear()
Remove all items from the List.
iterator insert(iterator position, const T &x)
Insert an element to the List before the element specified by the iterator.
const_iterator find(const T &x, const_iterator first, const_iterator last) const
Find element x in the list range specified by the first and last iterators.
bool StrictWeakOrdering(const T1 &lhs1, const T1 &rhs1)
void swap(Array< T > &x, Array< T > &y)
L::const_reverse_iterator const_reverse_iterator
void resize(size_type new_size, const T &x)
Ensure the List has a given size.
void remove_if(Predicate p)
Removes all elements from the list for which the unary predicate p is true.
void swap(COWReference< T > &arg)
void pop_back()
Remove the last element in the List.
reverse_iterator rbegin()
List()
Default Constructor.
L::const_reference const_reference
L::reverse_iterator reverse_iterator
bool contains(const T &x, const_iterator first, const_iterator last) const
Determine if element x is contained in the list range specified by the first and last iterators.
void push_front(const T &x)
Prepend the specified element at the front of the List.
bool operator==(const Array< T > &x, const Array< T > &y)
size_type max_size() const
void pop_front()
Remove the first element in the List.
void push_back(const T &x)
Append the specified element to the end of the List.
This class is a wrapper around std::list<> and adds COW capabilities.
L::difference_type difference_type
L::const_pointer const_pointer
T * COWReferenceClone(T *obj)
void remove(const T &value)
Remove the specified element from the List.
void reverse()
Reverse the order of elements in the list.
L::const_iterator const_iterator