COIN-OR::LEMON - Graph Library

Opened 9 years ago

Closed 9 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)

330-bugfix-e9c203fb003d.patch (5.6 KB) - added by Peter Kovacs 9 years ago.

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Peter Kovacs

comment:1 Changed 9 years ago by Peter Kovacs

Status: newassigned

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.

comment:2 Changed 9 years ago by Alpar Juttner

When do they have to be initialized to NULL? (Wouldn't it be appropriate to add a test for it?)

comment:3 in reply to:  2 Changed 9 years ago by Peter Kovacs

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 in reply to:  1 Changed 9 years ago by Alpar Juttner

Resolution: fixed
Status: assignedclosed

Replying to kpeter:

It is on the top of [c6acc34f98dc], it can be merged into all branches.

Done, see [2e9655402778], [994c7df296c9], [76689f2fc02d] and [1b89e29c9fc7].

Note: See TracTickets for help on using tickets.