vee_algorithm.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 /* COPYRIGHT
00004  *
00005  * This file is part of the Visual Effects Engine - VEE
00006  *
00007  * Read the "VEE-LICENSE" file for the license.
00008  *
00009  * Authors & Copyright:   
00010  *
00011  * Tommi Ilmonen, Tuukka Heikura, Marko Myllymaa and 
00012  * Janne Kontkanen 2001-2004
00013  *
00014  * Additional copyrights: Tekes 2003-2004
00015  *
00016  * firstname.lastname@hut.fi
00017  *
00018  */
00019 
00020 #ifndef VEE_ALGORITHM_H
00021 #define VEE_ALGORITHM_H
00022 
00029 namespace VEE_Algorithm 
00030 {
00031 
00034   template <class Iterator, class Value> 
00035   void setAll (Iterator first, Iterator last, const Value & v)
00036   {
00037     while(first != last) { (*first) = v; first++; }
00038   }
00039 
00042   template <class Iterator> 
00043   void deleteAll (Iterator first, Iterator last)
00044   {
00045     while(first != last) { delete *first; first++; }
00046   }
00047   
00049   template <class Iterator, class Value> 
00050   void accumulate (Iterator first, Iterator last, const Value & v)
00051   {
00052     while(first != last) { (*first) += v; first++; }
00053   }
00054   
00056   template <class T> 
00057   void swap(T & v1, T & v2)
00058   {
00059     T tmp = v2;
00060     v2 = v1;
00061     v1 = tmp;
00062   }
00063   
00064 }
00065 
00066 #endif

Generated on Mon Mar 12 21:09:00 2007 for VEE - The Visual Effects Engine by  doxygen 1.4.6