Go to Overview over all GrAL packages.
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Container/range.h

Go to the documentation of this file.
00001 #ifndef NMWR_GB_PRINT_RANGE_H
00002 #define NMWR_GB_PRINT_RANGE_H
00003 
00004 
00005 // $LICENSE
00006 
00007 #include <iostream.h>
00008 
00023 template<class It>
00024 struct iter_range {
00025   It b;
00026   It e;
00027   iter_range(It bb, It ee) : b(bb), e(ee) {}
00028 };
00029 
00033 template<class It>
00034 inline 
00035 iter_range<It> range(It bb, It ee) 
00036 { return iter_range<It>(bb,ee); }
00037 
00038 
00042 template<class It>
00043 inline
00044 ostream& operator<<(ostream& out, iter_range<It> r)
00045 {
00046   while(r.b != r.e) {
00047     out << *(r.b) << ' ';
00048     ++r.b;
00049   }
00050   return out;
00051 }
00052 
00056 template<class It>
00057 inline
00058 istream& operator>>(istream& in, iter_range<It> r)
00059 {
00060   while(r.b != r.e) {
00061     in  >> *(r.b);
00062     ++r.b;
00063   }
00064   return in;
00065 }
00066 
00067 #endif
00068 

Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 15:57:14 2002 for Sequence by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000