diff options
Diffstat (limited to 'core/fp_fo_adapter.hpp')
-rw-r--r-- | core/fp_fo_adapter.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/core/fp_fo_adapter.hpp b/core/fp_fo_adapter.hpp new file mode 100644 index 0000000..0c5740b --- /dev/null +++ b/core/fp_fo_adapter.hpp @@ -0,0 +1,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 + |