aboutsummaryrefslogtreecommitdiffstats
path: root/core/fp_fo_adapter.hpp
blob: 0c5740bd85f2212c5020e5ea85424875637c85f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef FP_FO_ADAPTER_HPP
#define FP_FO_ADAPTER_HPP
#include "optimizer.hpp"

namespace opt_utilities
{
  template <typename rT,typename pT>
  class fp_fo_adapter
    :public func_obj<rT,pT>
  {
  private:
    fp_fo_adapter();
    rT (*fp)(const pT&);
  public:
    fp_fo_adapter(rT (*_fp)(const pT&))
    :fp(_fp)
    {}
    
    fp_fo_adapter<rT,pT>* do_clone()const
    {
      return new fp_fo_adapter<rT,pT>(*this);
    }
    
    rT do_eval(const pT& x)
    {
      return fp(x);
    }
  };
};


#endif