Calling an allocator destroy?

Stefan Olsson stefan@noname4us.com
Fri Nov 2 14:59:00 GMT 2001


Hi!

We have created a class that has the following outline (all methods are
omitted here):

        typedef std::__allocator<char,
std::pthread_alloc>
std_char_pthread_alloc;
        typedef std::basic_string< char, std::char_traits<char>,
std_char_pthread_alloc >       std_pthread_basic_string;

       class pthread_string : public std_pthread_basic_string
        {
                public:
                        pthread_string() throw():
std_pthread_basic_string()
                        {
                        }
        }

Why? Because we need some containers to use the pthread_allocator and
some the default (global one) in a multithreaded enviorment.

The question:
How do we write a destructor for this class? We are thinking in the
terms of:

                        ~pthread_string()
                        {
                                this->get_allocator().destroy( XXX );
                        }

But the question is how to call the destroy method correctly?

Thanks in advance!

/Stefan

--
Military intelligence is a contradiction in terms.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20011102/1a1e0c08/attachment.htm>


More information about the Libstdc++ mailing list