Method Pointer weight accessor. More...
#include <weight_accessor.hpp>
Public Types | |
typedef WeightType(ElementType::* | WeightAccessorMethodPointer) () const |
Pointer to a const method of ElementType that returns double. | |
Public Member Functions | |
mp_weight_accessor () | |
Default constructor, accessor will return 1 all the time. | |
mp_weight_accessor (WeightAccessorMethodPointer wptr) | |
Constructor from a WeightAccessorMethodPointer. More... | |
WeightType | operator() (ElementType const &e) const |
Functor implementation. More... | |
Method Pointer weight accessor.
Weight accessor for element classes that provide access to their weight through a method signed WeightType (ElementType::*)() const
.
This class is very similar to std::const_mem_fun_ref_t
. The only two differences are
These differences allow mp_weight_accessor to be used as a default type for is_picked_systematic weight accessor, since a default-value initialization won't imply segfault. However, access is a bit slower because of the extra check for a non-NULL pointer. If the pointer is NULL, operator()
returns 1.
See Accessors for more details.
Definition at line 61 of file weight_accessor.hpp.
|
inline |
Constructor from a WeightAccessorMethodPointer.
wptr | Pointer to the method of ElementType that returns the element weight. |
Definition at line 80 of file weight_accessor.hpp.
|
inline |
Functor implementation.
e.*wptr_()
else. Definition at line 88 of file weight_accessor.hpp.