Proton  1.1.1
Make porting easy from Python to C++11
proton::deque_< T, A > Class Template Reference

a deque extension implementing python's list-like interfaces. More...

#include <proton/deque.hpp>

Inherits std::deque< T >.

List of all members.

Public Member Functions

template<typename... argT>
 deque_ (argT &&...a)
 forwarding ctor.
 deque_ (std::initializer_list< T > a)
 initializer_list forwarding ctor.
 deque_ (const deque_ &x)
 copy ctor.
 deque_ (deque_ &&x) noexcept
 move ctor.
deque_operator= (const deque_ &x)
 assign.
 operator baseT & ()
 cast to std::deque<>&.
T & operator[] (offset_t i)
 [i] in python
const T & operator[] (offset_t i) const
 [i] in python
deque_ operator() (offset_t i) const
 slice of [i:]
deque_ operator() (offset_t i, offset_t j) const
 slice of [i:j]
deque_ operator() (offset_t i, offset_t j, size_t k) const
 slice of [i:j:k]
void append (const T &x)
 append an item at the end.
size_t count (const T &x) const
 total number of occurences of x.
void del (offset_t i)
 delete the i-th item
void del (offset_t i, offset_t j)
 delete from i-th to the j-th items
void del_to_end (offset_t i)
 delete from i-th item to the end
template<typename seqT >
void extend (const seqT &x)
 append items from a sequence.
offset_t index (const T &val) const
 index of the first occurence of a value.
void insert (offset_t i, const T &val)
 insert value at offset i.
pop (offset_t i=-1)
 pop an item from the sequence.
void remove (const T &val)
 remove the first occurence of a value.
void reverse ()
 reverses the items in place.
void sort ()
 sort the items in place.
template<class cmpT >
void sort (cmpT cmp)
 sort the items in place using a customized cmp.

Additional Inherited Members

- Public Attributes inherited from std::deque< T >
elements
 STL member.

Detailed Description

template<typename T, typename A = smart_allocator<T>>
class proton::deque_< T, A >

a deque extension implementing python's list-like interfaces.

Examples:
deque.cpp, and string.cpp.

Definition at line 186 of file deque.hpp.


Member Function Documentation

template<typename T, typename A = smart_allocator<T>>
offset_t proton::deque_< T, A >::index ( const T &  val) const
inline

index of the first occurence of a value.

Parameters:
valthe value.
Exceptions:
std::invalid_argumentif there is no such a value.

Definition at line 412 of file deque.hpp.

template<typename T, typename A = smart_allocator<T>>
void proton::deque_< T, A >::insert ( offset_t  i,
const T &  val 
)
inline

insert value at offset i.

Parameters:
ithe offset, like python, -1 means the last position.
valthe value.
Exceptions:
proton::errif i is bad.

Definition at line 426 of file deque.hpp.

template<typename T, typename A = smart_allocator<T>>
T proton::deque_< T, A >::pop ( offset_t  i = -1)
inline

pop an item from the sequence.

Parameters:
ithe index of the itme, default is -1, the last item.
Returns:
the value at offset i.
Exceptions:
proton::errif i is bad.

Definition at line 443 of file deque.hpp.

template<typename T, typename A = smart_allocator<T>>
void proton::deque_< T, A >::remove ( const T &  val)
inline

remove the first occurence of a value.

Parameters:
valthe value.
Exceptions:
std::invalid_argumentif there is no such a value.

Definition at line 455 of file deque.hpp.


The documentation for this class was generated from the following file: