Om
iterator_sink.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Sink_IteratorSink_
16 
17  #include "om/sink/iterator_sink.hpp"
18 
19 #else
20 
21 // MARK: - Om::Sink::IteratorSink
22 
23  #define Template_ \
24  template < \
25  typename ThisItem, \
26  typename ThisIterator \
27  >
28 
29  #define Type_ \
30  Om::Sink::IteratorSink< \
31  ThisItem, \
32  ThisIterator \
33  >
34 
35 // MARK: public (non-static)
36 
37 Template_
38 inline Type_::IteratorSink(ThisIterator theIterator):
39 thisIterator(theIterator) {}
40 
41 Template_
42 inline Type_ & Type_::operator =(IteratorSink theIteratorSink) {
43  this->Swap(theIteratorSink);
44  return *this;
45 }
46 
47 Template_
48 inline void Type_::Push(ThisItem & theItem) {
49  *this->thisIterator++ = theItem;
50 }
51 
52 Template_
53 inline void Type_::Swap(IteratorSink & theIteratorSink) {
55  this->thisIterator,
56  theIteratorSink.thisIterator
57  );
58 }
59 
60  #undef Type_
61  #undef Template_
62 
63 // MARK: - boost::
64 
65 template <
66  typename TheItem,
67  typename TheIterator
68 >
69 inline void boost::swap(
71  TheItem,
72  TheIterator
73  > & theFirst,
75  TheItem,
76  TheIterator
77  > & theSecond
78 ) {
79  theFirst.Swap(theSecond);
80 }
81 
82 #endif
A Sink adapter for an output iterator.
Om header file.
void swap(Om::Language::Expression &, Om::Language::Expression &)