Opened 12 years ago
Last modified 9 years ago
#466 new enhancement
Extended std::vector<>
| Reported by: | Alpar Juttner | Owned by: | Alpar Juttner |
|---|---|---|---|
| Priority: | major | Milestone: | LEMON 1.5 release |
| Component: | core | Version: | hg main |
| Keywords: | Cc: | ||
| Revision id: |
Description
Based upon the idea of #462.
We could implement a wrapper around std::vector<> with the following two extra features.
- A extra permanent iterator. It has the same functionality as
std::vector::iteratorbut remains valid even when the vector is extended by new elements. Technically, it contains a pointer to the base vector plus an index. - An
indextype. In non-debug mode it is just asize_t, but in debug mode it also contains a pointer to the vector it indexes, thusoperator[]()is able to check if the index indexes the right vector (and also if it is in the actual range).
Both would be safer alternatives to referencing std::vector<>'s elements by integer indices.
Attachments (1)
Change History (3)
comment:1 Changed 12 years ago by
comment:2 Changed 9 years ago by
| Milestone: | LEMON 1.4 release → LEMON 1.5 release |
|---|
Note: See
TracTickets for help on using
tickets.


The point is that I'm just debugging a code which uses many
std::vector<>s and (integer) cross references between them and does something wrong. If we used one of the features above for cross referencing, it would immediately locate the root of the problem.