[odb-users] Re: Support c++11
    Andrey Devyatka 
    an9bit at gmail.com
       
    Fri Jun  1 07:28:14 EDT 2012
    
    
  
Hi, odb-users,
Hi, Boris,
Sorry, I did not read the documentation. Everything is written:
for(DBO at : res) {
     list.push_back(std::shared_ptr<DBO>(new DBO(at)));
}
Sorry.
Andrey
01.06.2012 16:39, Andrey Devyatka написал:
> 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