Boost logo

Boost Users :

From: Sebastian Weber (sebastian.weber_at_[hidden])
Date: 2007-02-09 10:52:01


Hi Doug,

> The problem here is that vector<bool> does a space "optimization" by
> packing bool values into individual bits, and you can't take the
> address of a bit. Instead of trying to get a pointer to the bits, use
> iterators into the bit vector, e.g.,
>
> bfs_search(..., make_my_vistor(bit_props.begin()), ...)

I already thought that this might cure the problem, but it did not. I do
not remember the error message, since I use a different ansatz by now.
However, the program crashed with the .begin()-directive (maybe my
program was faulty, but I don't know). Nevertheless, thanks a lot for
your help.

Anyway, even it is off-topic, I'm wondering weather a

put(someMap, key, get(someMap, key) + 1)

is much slower than doing it directly (I know that map is a vector and
key is a std::size_t-index) via

++someMap[key];

Or is the compiler so smart to make the first expression equal to the
last one? Since I'm doing lots of stuff like this (and I don't care to
much about generality, but rather raw performance), this would be very
important to know. For sure I will try it out, but I'm anyway interested
in your opinion, concering that point.

Greetings,

Sebastian

>
> Cheers,
> Doug
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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