rowset support get size by std::distance. However, if calculate the size by std::distance first, then the rowset begin iterator can not point to expected beginning any more. Just like the following code:
rowset<row> rows = (sess.prepare << "select * from mytable"); // assume there are 10 rows
cout << std::distance(rows.begin(), rows.end())<< endl; // here is 10
cout << std::distance(rows.begin(), rows.end())<< endl; // here is 0
rowset support get size by
std::distance
. However, if calculate the size bystd::distance
first, then therowset
begin iterator can not point to expected beginning any more. Just like the following code: