This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Calling an allocator destroy?


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.
 
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]