vtf-logo

Identity.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00008 #if !defined(__ads_Identity_h__)
00009 #define __ads_Identity_h__
00010 
00011 #include "../defs.h"
00012 
00013 #include <functional>
00014 
00015 BEGIN_NAMESPACE_ADS
00016 
00017 //-----------------------------------------------------------------------------
00021 // @{
00022 
00024 template<typename T>
00025 struct Identity : 
00026   public std::unary_function<T,T> {
00028   T&
00029   operator()(T& x) const { 
00030     return x; 
00031   }
00032 
00034   const T&
00035   operator()(const T& x) const { 
00036     return x; 
00037   }
00038 };
00039 
00041 template<typename T>
00042 inline
00043 Identity<T>
00044 identity() {
00045   return Identity<T>();
00046 }
00047 
00048 // @}
00049 
00050 END_NAMESPACE_ADS
00051 
00052 #endif

Generated on Fri Aug 24 12:55:24 2007 for Algorithms and Data Structures Package by  doxygen 1.4.7