[odb-users] update() doesn't offer a constT& signature
Boris Kolpackov
boris at codesynthesis.com
Mon Sep 4 05:57:21 EDT 2023
MM <finjulhich at gmail.com> writes:
> I get compile errors when I try to do
>
> void f(const & myobj) {
> ...
> db.update<MyType>(myobj);
> ...
> }
>
> There are a number of overloads in database.hxx but none of them takes
> const T& alone.
The const version of database::update() is available unless update()
would need to modify the object during update. This happens, for example,
if the object uses optimistic concurrency and update() has to increment
the version. It's impossible to say what exactly causes this in your
case without seeing the definition of MyType as well as the error. In
fact, always providing the exact diagnostics you get as well as all the
relevant code fragments is strongly recommended.
More information about the odb-users
mailing list