Tensor Comprehensions
|
#include <mapping_options.h>
Public Types | |
using | Setter = std::function< void(T)> |
using | Getter = std::function< T()> |
Public Member Functions | |
ValueAccessor (const Setter &s, const Getter &g) | |
ValueAccessor (const ValueAccessor &)=default | |
operator T () const | |
ValueAccessor & | operator= (const T &t) |
Private Attributes | |
Setter | setter_ |
Getter | getter_ |
Simple template class to wrap getters and by-value setters. Instances of this class can be implicitly converted to the template parameter type by calling the provided getter function. They can be assigned from an instance of the template parameter type by calling the setter function provided in the constructor.
Note that this class does not in any sense extend the lifetime of the accessed object. Make sure that getters and setters actually change the object, e.g., capture by-reference in lambdas.
using tc::ValueAccessor< T >::Getter = std::function<T()> |
using tc::ValueAccessor< T >::Setter = std::function<void(T)> |
|
inline |
|
default |
|
inline |
|
inline |
|
private |
|
private |