[odb-users] Query on non-empty container in view
Boris Kolpackov
boris at codesynthesis.com
Tue Oct 25 11:27:37 EDT 2016
Hi Lukas,
Lukas Obermann <obermann.lukas at gmail.com> writes:
> So, having a class that has some containers
> (std::vector<odb::lazy_shared_ptr>) in a class and a view on top of that to
> access the elements.
>
> What is the recommended way of querying that the vector must have at least
> one element in it?
If pointers in your vector cannot be NULL (which would generally be
pointless in this case, no pun intended), then you can just join
the pointed-to object and add a test like "its object id is not NULL"
(or use an appropriate join type).
Boris
More information about the odb-users
mailing list