vnl_identity.h
Go to the documentation of this file.
1 // This is core/vnl/vnl_identity.h
2 #ifndef vnl_identity_h_
3 #define vnl_identity_h_
4 //:
5 // \file
6 // \brief Contains class vnl_identity
7 // \author Andrew W. Fitzgibbon, Oxford RRG
8 // \date 07 Dec 98
9 //
10 // \verbatim
11 // Modifications
12 // LSB (Manchester) 23/1/01 Tidied documentation
13 // \endverbatim
14 //-----------------------------------------------------------------------------
15 
16 #include <vnl/vnl_unary_function.h>
17 #include "vnl/vnl_export.h"
18 
19 template <class T>
20 class VNL_EXPORT vnl_identity : public vnl_unary_function<T,T>
21 {
22  public:
23  vnl_unary_function<T,T>* Copy() const override {
24  vnl_identity<T>* copy = new vnl_identity<T>;
25  *copy = *this;
26  return copy;
27  }
28 
29  T f(T const& x) override {
30  return x;
31  }
32 };
33 
34 #endif // vnl_identity_h_
virtual Return f(Argument const &i)=0
Apply the function.
Abstract 1D map.
virtual vnl_unary_function< Return, Argument > * Copy() const
Copy should allocate a copy of this on the heap and return it.
Abstract 1D map between two types (read spaces).
Definition: vnl_fwd.h:30