Boost logo

Boost Users :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2006-05-10 19:56:51


 
Andreas Sæbjørnsen wrote:

> I need some advice regarding how I should copy the boost data
> structures I get from 'advanced_preprocessing_hooks.h'.
> The task at hand is to copy some of the data structures from
> Wave and store it separate form the memory Wave allocates so
> that after the Wave preprocessing step has finished all it's
> memory can be freed.
>
> Example: e.g making a copy of the
> 'std::vector<std::list<PreprocessingInfo::token_type,boost::fa
> st_pool_allocator<PreprocessingInfo::token_type> > >'
> representing the arguments in the expansion of a macro in the
> function 'expanding_function_like_macro'.
>
> Syntactically it would be gre at to be able to make a copy
> using the operator=, but as far as I can see this is only
> possible if I am also using the fast_pool_allocator. If I use
> the fast_pool_allocator I am afraid that my copies will be
> put into the memory pool allocated by Wave and therefore that
> memory cannot be safely freed. Is this corect?

I'm not sure here. My (unverified) guess is, that the memory pool will be
free'd only after the last item allocated from it got free'd. This shouldn't
be a problem as long as the memory pool doesn't live in a shared library
which gets unloaded prematurely.

But anyway, doesn't using std::copy() for the embedded list<>'s allow to
change to any adequate data structure?

Regards Hartmut


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