[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

Boost: Use Of Non-Dynamic Data Structures?

Chris Gordon-Smith

11/2/2008 9:04:00 PM

I have recently started using the Boost Graph Library(BGL);
overall I am finding it excellent and very powerful.

One thing worries me a little. It seems to be standard practice
when using BGL to create a data structure with a specific size,
and then pass a pointer (or iterator) to the start of that data
structure to an algorithm as an argument.

Is this OK? Isn't it better to dynamically allocate memory for
containers according to need, or am I missing the point?

--
Chris Gordon-Smith
London
www.simsoup.info
1 Answer

Chris Gordon-Smith

11/3/2008 8:10:00 PM

0

Chris Gordon-Smith wrote:

> I have recently started using the Boost Graph Library(BGL);
> overall I am finding it excellent and very powerful.
>
> One thing worries me a little. It seems to be standard practice
> when using BGL to create a data structure with a specific size,
> and then pass a pointer (or iterator) to the start of that data
> structure to an algorithm as an argument.
One thing I should have made clear in the original posting: The algorithm
then populates the data structure that the argument points to. My concern
is that if the data structure was created with the wrong size, there will
be trouble.
>
> Is this OK? Isn't it better to dynamically allocate memory for
> containers according to need, or am I missing the point?
>