Boost: Use Of Non-Dynamic Data Structures?

  • Thread starter Chris Gordon-Smith
  • Start date
C

Chris Gordon-Smith

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?
 
C

Chris Gordon-Smith

Chris said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top