Opened 15 years ago
Closed 15 years ago
#330 closed defect (fixed)
Bug fix for map iterators
Reported by: | Peter Kovacs | Owned by: | Peter Kovacs |
---|---|---|---|
Priority: | major | Milestone: | LEMON 1.2 release |
Component: | core | Version: | hg main |
Keywords: | Cc: | ||
Revision id: |
Description
Attachments (1)
Change History (5)
Changed 15 years ago by
Attachment: | 330-bugfix-e9c203fb003d.patch added |
---|
comment:1 follow-up: 4 Changed 15 years ago by
Status: | new → assigned |
---|
comment:2 follow-up: 3 Changed 15 years ago by
When do they have to be initialized to NULL? (Wouldn't it be appropriate to add a test for it?)
comment:3 Changed 15 years ago by
Replying to alpar:
When do they have to be initialized to NULL? (Wouldn't it be appropriate to add a test for it?)
The main reason for these fixes is to replace references with pointers. If we use pointers, then it is not so important to initialize them to NULL, however, the non-initialized references cause compiler errors.
A use case for this is mentioned in #320. Let's suppose you would like to apply STL algorithms (that operate on ranges) on standard graph maps using their MapIt
or ConstMapIt
iterators. E.g.
typedef SmartDigraph::NodeMap<int>::ConstMapIt MapIt; Map map(g); for_each(MapIt(map), MapIt(INVALID), action_functor);
Currently, we have constructor for MapIt(INVALID)
, but it is faulty, so this code does not compile.
Similar tests are included in maps_test.cc
in [8ddb7deabab9] (see #320), but they are disabled and waiting for these bug fixes.
comment:4 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Replying to kpeter:
It is on the top of [c6acc34f98dc], it can be merged into all branches.
Done, see [2e9655402778], [994c7df296c9], [76689f2fc02d] and [1b89e29c9fc7].
The attached patch [e9c203fb003d] contains bug fixes for the map extenders. The reference members are replaced with pointers to handle the cases when they have to be initialized to
NULL
.It is on the top of [c6acc34f98dc], it can be merged into all branches.