[odb-users] std::transform changes the begin iterator
Zhao Xiang
xiang.zhao at gamegou.com
Mon Oct 26 23:30:46 EDT 2015
Dear ODB support,
I'm currently using odb 2.4.0, and I think I've found a bug with odb::result and std::transform.
My code is like below:
odb::result<user_player> players = db.query<user_player>(...);
std::vector<uint32_t> playerIds;
playerIds.resize(players.size());
std::transform(players.begin(), players.end(), playerIds.begin(), [](const user_player& p)
{
return p.key.player_id;
});
assert(players.size() > 0);//ok
assert(players.begin() != players.end());//oops
After some debug I noticed the value of players.begin() is changed after the std::transform call.
So I think this is a bug in odb's iterator implementation.
Regards
Zhao Xiang
More information about the odb-users
mailing list