[geos-devel] Using std::vector<bool> container

Mateusz Loskot mateusz at loskot.net
Mon Jul 10 03:13:41 EDT 2006


Hi,

I found this old message unreplied, so here I give my response
with longer delay. Sorry for that.

strk at refractions.net wrote:
> Mateusz, the role of vector<bool> used there is to "tag" each
> vertex in a CoordinateSequence telling wheter or not it is going
> to be into the result. Size of the CoordinateSequence is not
> known at compile-time, and we need a random access iterator 
> to couple each vertex with this information. 

So, we can't used deque because it does not support dynamic resize.
Also, we can't used bitset becasue it does not support iterators.

> If we want to keep tracking JTS as close as possible I'd
> use small integers instead of bools and still use a vector.
> Does it make sense ?

Yes, vector of integers is the best and safest solution I see.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net




More information about the geos-devel mailing list