libzypp: zypp/base/Collector.h Source File

libzypp 17.38.10

Collector.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_BASE_COLLECTOR_H
13#define ZYPP_BASE_COLLECTOR_H
14
16namespace zypp
17{
19 namespace functor
20{
21
23 //
24 // CLASS NAME : Collector<TOutputIterator>
25 //
36 template<class TOutputIterator>
37 struct Collector
38 {
39 Collector( TOutputIterator iter_r ) : _iter( iter_r ) {}
40
41 template<class Tp>
42 bool operator()( const Tp & value_r ) const
43 {
44 *_iter++ = value_r;
45 return true;
46 }
47
48 private:
49 mutable TOutputIterator _iter;
50 };
51
52
54 template<class TOutputIterator>
55 inline Collector<TOutputIterator> collector( TOutputIterator iter_r )
56 { return Collector<TOutputIterator>( iter_r ); }
57
59
61} // namespace functor
62
64} // namespace zypp
66#endif // ZYPP_BASE_COLLECTOR_H
zypp::functor
Definition Collector.h:20
zypp::functor::collector
Collector< TOutputIterator > collector(TOutputIterator iter_r)
relates: Collector Convenience constructor.
Definition Collector.h:55
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::functor::Collector
Functor feeding values to an output_iterator.
Definition Collector.h:38
zypp::functor::Collector::operator()
bool operator()(const Tp &value_r) const
Definition Collector.h:42
zypp::functor::Collector::Collector
Collector(TOutputIterator iter_r)
Definition Collector.h:39
zypp::functor::Collector::_iter
TOutputIterator _iter
Definition Collector.h:49