38#ifndef BLOCXX_LIST_HPP_INCLUDE_GUARD_
39#define BLOCXX_LIST_HPP_INCLUDE_GUARD_
40#include "blocxx/BLOCXX_config.h"
48template<
class T>
class List;
60template<
class T>
class List
63 typedef std::list<T>
L;
94 template<
class InputIterator>
95 List(InputIterator first, InputIterator last)
236 return m_impl->max_size();
284 return m_impl->insert(position, x);
295 return m_impl->insert(position);
304 template<
class InputIterator>
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();
603 template<
class BinaryPredicate>
void unique(BinaryPredicate bp)
660 return new std::list<T>(*obj);
COWReference A smart pointer that uses non-intrusive reference counting.
This class is a wrapper around std::list<> and adds COW capabilities.
void resize(size_type new_size, const T &x)
Ensure the List has a given size.
void reverse()
Reverse the order of elements in the list.
iterator erase(iterator position)
Remove an element from the List specified with an iterator.
void pop_front()
Remove the first element in the List.
List(int n, const T &value)
Construct a List that consist of a specified number of elements that are copies of a given object.
void insert(iterator pos, int n, const T &x)
Insert a specified number of elements that are copies of a given object before the given position in ...
iterator insert(iterator position, const T &x)
Insert an element to the List before the element specified by the iterator.
iterator find(const T &x, iterator first, iterator last)
Find element x in the list range specified by the first and last iterators.
void unique(BinaryPredicate bp)
Remove all elements from the List for which the binary predicate bp is true.
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 insert(iterator pos, long n, const T &x)
Insert a specified number of elements that are copies of a given object before the given position in ...
const_iterator end() const
L::const_iterator const_iterator
const_reference front() const
L::difference_type difference_type
L::const_pointer const_pointer
List(size_type n)
Construct a List that consist of a specified number of elements that have be constructed using the de...
void sort(StrictWeakOrdering swo)
Sort the list using the specified comparisation class.
void pop_back()
Remove the last element in the List.
List()
Default Constructor.
void insert(iterator pos, size_type n, const T &x)
Insert a specified number of elements that are copies of a given object before the given position in ...
iterator erase(iterator first, iterator last)
Remove elements from the List specified by a beginning and ending iterator.
const_iterator begin() const
const_reverse_iterator rbegin() const
void insert(iterator position, InputIterator first, InputIterator last)
Insert a range of elements before a given position in the List.
void remove(const T &value)
Remove the specified element from the List.
L::const_reference const_reference
void merge(List &x)
Merge the current and specified lists, producing a combined list that is ordered with respect to the ...
void sort()
Sort the list using the < operator to compare elements.
friend bool operator==(const List< T > &x, const List< T > &y)
Determine equality of two Lists comparing the size of both lists and all elements in the same positio...
void clear()
Remove all items from the List.
void splice(iterator position, List &x, iterator i)
@doctodo Move the specified element from list x pointed to by iterator i into the current list at the...
void resize(size_type new_size)
Ensure the List has a given size appending a default-constructed object to the end of the List if it ...
void remove_if(Predicate p)
Removes all elements from the list for which the unary predicate p is true.
iterator find(const T &x)
Find element x in the list.
const_reference back() const
List(InputIterator first, InputIterator last)
Construct a List from a range specified with InputIterators.
const_reverse_iterator rend() const
void merge(List &x, StrictWeakOrdering swo)
Merge the current and specified list, producing a combined list that is ordered with respect to the s...
List(size_type n, const T &value)
Construct a List that consist of a specified number of elements that are copies of a given object.
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.
void unique()
Remove all duplicate elements from the List.
void push_back(const T &x)
Append the specified element to the end of the List.
void swap(List< T > &x)
Exchanges the elements of the current list with those of another.
List(L *toWrap)
Constructor.
size_type max_size() const
L::const_reverse_iterator const_reverse_iterator
void push_front(const T &x)
Prepend the specified element at the front of the List.
bool contains(const T &x) const
Determine if element x is contained in the list.
void splice(iterator position, List &x)
@doctodo Move the specified list into the current list at the given position.
L::reverse_iterator reverse_iterator
reverse_iterator rbegin()
void splice(iterator position, List &x, iterator first, iterator last)
@doctodo Move the elements from list x specified by first and last iterators into the current list at...
const_iterator find(const T &x) const
Find element x in the list.
iterator insert(iterator position)
Insert an default-constructed element to the List before the element specified by the iterator.
List(long n, const T &value)
Construct a List that consist of a specified number of elements that are copies of a given object.
T * COWReferenceClone(T *obj)
bool operator<(const Array< T > &x, const Array< T > &y)
bool operator==(const Array< T > &x, const Array< T > &y)
bool StrictWeakOrdering(const T1 &lhs1, const T1 &rhs1)
void swap(Array< T > &x, Array< T > &y)