Om
container_front_sink.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Sink_ContainerFrontSink_
16 
18 
19 #else
20 
21 // MARK: - Om::Sink::ContainerFrontSink
22 
23  #define Template_ \
24  template < \
25  typename ThisItem, \
26  typename ThisContainer \
27  >
28 
29  #define Type_ \
30  Om::Sink::ContainerFrontSink< \
31  ThisItem, \
32  ThisContainer \
33  >
34 
35 // MARK: public (non-static)
36 
37 Template_
38 inline Type_::ContainerFrontSink(ThisContainer & theContainer):
39 thisContainer(theContainer) {}
40 
41 Template_
42 inline Type_ & Type_::operator =(ContainerFrontSink theContainerFrontSink) {
43  this->Swap(theContainerFrontSink);
44  return *this;
45 }
46 
47 Template_
48 inline void Type_::Push(ThisItem & thisItem) {
49  this->thisContainer.push_front(thisItem);
50 }
51 
52 Template_
53 inline void Type_::Swap(ContainerFrontSink & theContainerFrontSink) {
55  this->thisContainer,
56  theContainerFrontSink.thisContainer
57  );
58 }
59 
60  #undef Type_
61  #undef Template_
62 
63 // MARK: - boost::
64 
65 template <
66  typename TheItem,
67  typename TheContainer
68 >
69 inline void boost::swap(
71  TheItem,
72  TheContainer
73  > & theFirst,
75  TheItem,
76  TheContainer
77  > & theSecond
78 ) {
79  theFirst.Swap(theSecond);
80 }
81 
82 #endif
A Sink adapter for a container; pushes items into the front.
void swap(Om::Language::Expression &, Om::Language::Expression &)