core/vnl/vnl_identity.h
Go to the documentation of this file.
00001 // This is core/vnl/vnl_identity.h
00002 #ifndef vnl_identity_h_
00003 #define vnl_identity_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Contains class vnl_identity
00010 // \author Andrew W. Fitzgibbon, Oxford RRG
00011 // \date   07 Dec 98
00012 //
00013 // \verbatim
00014 //  Modifications
00015 //   LSB (Manchester) 23/1/01 Tidied documentation
00016 // \endverbatim
00017 //-----------------------------------------------------------------------------
00018 
00019 #include <vnl/vnl_unary_function.h>
00020 
00021 template <class T>
00022 class vnl_identity : public vnl_unary_function<T,T>
00023 {
00024  public:
00025   vnl_unary_function<T,T>* Copy() const {
00026     vnl_identity<T>* copy = new vnl_identity<T>;
00027     *copy = *this;
00028     return copy;
00029   }
00030 
00031   T f(T const& x) {
00032     return x;
00033   }
00034 };
00035 
00036 #endif // vnl_identity_h_