-
[ My auto getObj(const std::vector<uint> & ids) {
using namespace sqlite_orm;
if(ids.size() == 0)
return storage->iterate<Obj>();
else
return storage->iterate<Obj>(where(in(&Obj::id,ids)));
} Results in this
[ Is this a bug? Similar code using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
it is not a bug cause auto wh = where(in(&Obj::id, ids));
wh = where(is_equal(&Obj::id, 5)); // compilation error will happen on this line You'll get compilation error cause |
Beta Was this translation helpful? Give feedback.
it is not a bug cause
storage.iterate
function returnsview_t<...giant type...>
where 'giant type' depends on arguments you pass. The first case has no arguments, the second has. You'll meet the same logic if you write a code like this:You'll get compilation error cause
where_t
which is returned bywhere
function has different template arguments -> it means that these two type returned bywhere(in(&Obj::id, ids))
andwhere(is_equal(&Obj::id, 5))
are different.Why
get_all
returns the same type withwhere
and without it? Cause this is a feature documented and guaranteed bys…