[odb-users] Persisting class instantiated from a template

Boris Kolpackov boris at codesynthesis.com
Fri Mar 17 11:24:17 EDT 2017


Hi Balázs,

Balázs Bayer <balazs.bayer at gmail.com> writes:

> std::array<float, 1000> const &getValue() const { return Value; };
> void setValue(const std::array<float, 1000> &NewValue) { Value =
> std::move(NewValue); };
> 
> then I guess the problem is, that when I want to change only one specific
> member of the Value array, I will have to construct another huge array, and
> pass it to setValue, which does not seem to be efficient to me. Do you have
> any suggestions, how to overcome this situation?

You can do by-reference access and modification:

const std::array<float, 1000>& getValue() const   { return Value; };
std::array<float, 1000>&       setValue()         { return Value; };

Boris



More information about the odb-users mailing list