[odb-users] Support c++11

Andrey Devyatka an9bit at gmail.com
Fri Jun 1 06:39:01 EDT 2012


Hi, odb-users,
Hi, Boris

I'm using c++11 with odb 2.0.0.

Now for the processing of query results, I use the following code:

std::list<std::shared_ptr<DBO>> list;
auto res = db->query<DBO>(query);
for(auto at = std::begin(res); at != std::end(res); ++at)
     list.push_back(std::shared_ptr<DBO>(at.load()));

I would like to use a range-based for-loops for the sample results:

for( auto at : res) {
     list.push_back(std::shared_ptr<DBO>(at.load()));  // so
     list.push_back(std::shared_ptr<DBO>(at));            // or so
}

Is it possible?

Andrey



More information about the odb-users mailing list