Lumiera  0.pre.03
»edit your freedom«
iter-stack.hpp File Reference

Go to the source code of this file.

Description

Conveniently iterable stack and queue containers.

Implemented as thin wrapper on top of std::deque In addition to providing a simplified interface, these wrappers comply to the "Lumiera Forward Iterator" concept, allowing to retrieve and discharge the contents of the container in a standard fashion, especially by using util::for_each, or by feeding them into a iterator based pipeline.

the builder extension point
while Lumiera Forward Iterators only allow to retrieve some elements once, the special extension point build(sequence) allows abstracted access to some limited manipulation of the sequence, without tying the client to a specific sequence or iterator implementation. This is intended for library templates, which typically can't make any assumptions regarding the iterator types used for instantiation.
Remarks
contrary to the usual (STL) containers, this wrapper is an iterator and a container at the same time. Which opens the interesting possibility to intermix retrieval and feeding of new elements. It can be seen as a zero overhead adapter to ease the use within Lumiera's library framework.
Note
EX_STRONG, since std::deque gives this guarantee for push and pop operations
Warning
STL containers aren't thread safe.
See also
IterStack_test
IterQueue_test
iter-adapter.hpp
itertools.hpp
IterSource (completely opaque iterator)

Definition in file iter-stack.hpp.

#include "lib/error.hpp"
#include "lib/iter-adapter.hpp"
#include "lib/nocopy.hpp"
#include "lib/util.hpp"
#include <deque>
#include <utility>

Classes

struct  IterQueue< TY >::Builder
 Adapter for use as opaque sequence. More...
 
struct  IterDequeStorage< TY >
 Wrapper to mark a std::deque instance for use as "state core" within lib::IterStateWrapper. More...
 
struct  IterQueue< TY >
 A Queue which can be pulled by iterating. More...
 
struct  IterStack< TY >
 A Stack which can be popped by iterating. More...
 

Functions

template<typename T >
IterQueue< T > elements (T const &elm)
 convenience free function to build an iterable sequence
 
template<typename T >
IterQueue< T > elements (T const &e0, T const &e1)
 
template<typename T >
IterQueue< T > elements (T const &e0, T const &e1, T const &e2)
 
template<typename T >
IterQueue< T > elements (T const &e0, T const &e1, T const &e2, T const &e3)
 
template<typename T >
IterQueue< T > elements (T const &e0, T const &e1, T const &e2, T const &e3, T const &e4)
 

Namespaces

 lib
 Implementation namespace for support and library code.