Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem of scope with the replace in static data structure
From: joaquin_at_[hidden]
Date: 2009-02-10 11:23:08


Hi Rodrigo,

First of all let me advice you to add the name of the library to the
subject line
of your post (in this case, [multi_index]) so that authors can more easily
track messages of their particular interest.

Rodrigo Dias Ferreira escribió:
> Hi there,
>
> I am having a problem with Boost.MultiIndex (I'm using Boost 1.37).
>
> So the problem is the following:
> I am using a static data structure, an index which I use as my graph
> repository:
> [...]
> For manipulating the graphs, I use a Graph_h (handler), which does a
> copy from the graph from this repository, does the changes in the local
> copy, and then the user has to call commitChanges(); to apply it in the
> repository (which I am using the replace function from the MultiIndex
> to commit it).
>
> The problem it is that inside the commitChanges(); I can retrieve from
> the repository through the find function (from MultiIndex).
>
> But when I the main program, it does not work (remark: I am trying
> right after calling the commitChanges(); It founds the graph, but it
> seems to be the old one, and I cannot retrieve the nodes...
>

The code is too convoluted for me to detect anything suspicious: the
fact that you check
for the newly replaced element just before commitChanges returns and
just after and
have differing results cannot possibly be related to the fact that
DynamicGraphs::_graphRep
is static, so I'd look somewhere else. Suggestions:

1. Can you provide a narrowed down compilable program exhibiting the
problem?
2. If the answer to 1 is no, can you post the debug console output of
your program?
3. You're copying values of the type Graph. How's this type defined? Has
it proper
copy semantics?
4. What happens if you try the after-replace check inside
Graph_h::commitChanges
(that is, the section beginning with cout << "DEBUG_at_commitChanges:before
replacing:_git Name: ")
*twice* rather than just onec? Still got positive results for both checks?

I'm sorry I can't be more helpful with the info you provide. Looking fwd to
having your feedback.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net