40#ifndef MADNESS_WORLD_MEM_FUNC_WRAPPER_H__INCLUDED
41#define MADNESS_WORLD_MEM_FUNC_WRAPPER_H__INCLUDED
75 static std::shared_ptr<T>
init() {
76 return std::shared_ptr<T>();
88 template <
typename ptrT,
typename memfnT,
typename resT>
143 template <
typename... argTs>
146 return ((*ptr_).*
memfn_)(std::forward<argTs>(args)...);
153 template <
typename Archive>
170 template <
typename ptrT,
typename memfnT>
224 template <
typename... argTs>
227 ((*ptr_).*
memfn_)(std::forward<argTs>(args)...);
234 template <
typename Archive>
249 template <
typename objT,
typename memfnT>
250 MemFuncWrapper<objT*, memfnT, typename result_of<memfnT>::type>
264 template <
typename objT,
typename memfnT>
265 MemFuncWrapper<const objT*, memfnT, typename result_of<memfnT>::type>
279 template <
typename objT,
typename memfnT>
280 MemFuncWrapper<objT*, memfnT, typename result_of<memfnT>::type>
294 template <
typename objT,
typename memfnT>
295 MemFuncWrapper<const objT*, memfnT, typename result_of<memfnT>::type>
309 template <
typename objT,
typename memfnT>
324 template <
typename objT,
typename memfnT>
338 template <
typename ptrT,
typename memfnT,
typename resT>
Functor wrapper for object and member function pointers.
Definition mem_func_wrapper.h:171
MemFuncWrapper(const MemFuncWrapper_ &other)
Copy constructor.
Definition mem_func_wrapper.h:196
memfnT memfn_type
Alias for the member function pointer type.
Definition mem_func_wrapper.h:186
memfnT memfn_
Pointer to the desired member function.
Definition mem_func_wrapper.h:174
ptrT ptr_
Pointer to the object.
Definition mem_func_wrapper.h:173
MemFuncWrapper()
Construct a wrapper with the default pointer for this type.
Definition mem_func_wrapper.h:189
MemFuncWrapper< ptrT, memfnT, void > MemFuncWrapper_
Alias for a member function with void return type.
Definition mem_func_wrapper.h:180
MemFuncWrapper_ & operator=(const MemFuncWrapper_ &other)
Definition mem_func_wrapper.h:213
void serialize(const Archive &ar)
Serializes a MemFuncWrapper.
Definition mem_func_wrapper.h:235
MemFuncWrapper(ptrT ptr, memfnT memfn)
Construct a wrapper from an object pointer and a member function pointer.
Definition mem_func_wrapper.h:205
void result_type
Alias for the function's return type.
Definition mem_func_wrapper.h:183
void operator()(argTs &&... args) const
Evaluates the member function, when dereferenced from the object pointer.
Definition mem_func_wrapper.h:225
Functor wrapper for object and member function pointers.
Definition mem_func_wrapper.h:89
MemFuncWrapper(const MemFuncWrapper_ &other)
Copy constructor that copies the object pointer and member function pointer.
Definition mem_func_wrapper.h:114
MemFuncWrapper_ & operator=(const MemFuncWrapper_ &other)
Definition mem_func_wrapper.h:131
MemFuncWrapper< ptrT, memfnT, void > MemFuncWrapper_
Alias for a wrapper that returns void.
Definition mem_func_wrapper.h:98
friend memfnT get_mem_func_ptr(const MemFuncWrapper_ &wrapper)
Definition mem_func_wrapper.h:158
result_type operator()(argTs &&... args) const
Evaluates the member function, when dereferenced from the object pointer.
Definition mem_func_wrapper.h:144
memfnT memfn_type
Alias for the type of the member function pointer.
Definition mem_func_wrapper.h:104
memfnT memfn_
Member function of the object's type.
Definition mem_func_wrapper.h:92
MemFuncWrapper(ptrT ptr, memfnT memfn)
Constructs a wrapper from an object pointer and a member function pointer.
Definition mem_func_wrapper.h:123
resT result_type
Alias for the function's result type.
Definition mem_func_wrapper.h:101
MemFuncWrapper()
Constructor that sets the pointer to the default value from DefaultInitPtr<ptrT>.
Definition mem_func_wrapper.h:108
void serialize(const Archive &ar)
Serializes a MemFuncWrapper.
Definition mem_func_wrapper.h:154
ptrT ptr_
Pointer to the object.
Definition mem_func_wrapper.h:91
auto T(World &world, response_space &f) -> response_space
Definition global_functions.cc:34
Defines madness::MadnessException for exception handling.
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
MemFuncWrapper< objT *, memfnT, typename result_of< memfnT >::type > wrap_mem_fn(objT &obj, memfnT memfn)
Create a member function wrapper (MemFuncWrapper) from an object and a member function pointer.
Definition mem_func_wrapper.h:251
memfnT get_mem_func_ptr(const MemFuncWrapper< ptrT, memfnT, resT > &wrapper)
Returns the member function pointer from a wrapper.
Definition mem_func_wrapper.h:339
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
static std::shared_ptr< T > init()
Get a default shared pointer.
Definition mem_func_wrapper.h:75
Default pointer to a. object of type T.
Definition mem_func_wrapper.h:53
static T init()
Get a default pointer.
Definition mem_func_wrapper.h:58
Member function traits in the spirit of boost function traits.
Definition function_traits.h:21
fnT::result_type type
Definition function_traits.h:97