Project

General

Profile

Feature #2094

No cbegin/cend for Dbo::collection ?

Added by Anonymous about 8 years ago.

Status:
New
Priority:
Low
Assignee:
-
Target version:
-
Start date:
08/08/2013
Due date:
% Done:

0%

Estimated time:

Description

Hi !

Dbo::collection provides iterators via begin and end, but fails to offer cbegin/cend.

It's not a big deal, but consider this :

        typedef Dbo::collection<Dbo::ptr<User>> TUsers;
        TUsers users = session.find<User>();
        for (TUsers::const_iterator it = users.begin(); it != users.end(); ++it)
        {
            // ..
        }

Now if we use 'auto' instead of 'TUsers::const_iterator', we get a non-const iterator. That's why standard C++11 containers now provides cbegin/cend.

Dbo::collection could do the same thing, so that it can be used like standard containers :

        auto users = session.find<User>();
        for (auto it = users.cbegin(); it != users.cend(); ++it)
        {
            // ..
        }

Best regards.

No data to display

Also available in: Atom PDF