libzypp  10.5.0
Collector.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_BASE_COLLECTOR_H
00013 #define ZYPP_BASE_COLLECTOR_H
00014 
00016 namespace zypp
00017 { 
00018 
00019 namespace functor
00020 { 
00021 
00023   //
00024   //    CLASS NAME : _Collector<_OutputIterator>
00025   //
00036   template<class _OutputIterator>
00037   struct _Collector
00038   {
00039     _Collector( _OutputIterator iter_r ) : _iter( iter_r ) {}
00040 
00041     template<class _Tp>
00042     bool operator()( const _Tp & value_r ) const
00043     {
00044       *_iter++ = value_r;
00045       return true;
00046     }
00047 
00048     private:
00049       mutable _OutputIterator _iter;
00050   };
00052 
00054   template<class _OutputIterator>
00055   inline _Collector<_OutputIterator> Collector( _OutputIterator iter_r )
00056   { return _Collector<_OutputIterator>( iter_r ); }
00057 
00059 
00061 } // namespace functor
00064 } // namespace zypp
00066 #endif // ZYPP_BASE_COLLECTOR_H