This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

[Fwd: Calling an allocator destroy?]


A bit of topic for the generic GCC list, but I would really appriciate input on this...

/Stefan

-- 
Military intelligence is a contradiction in terms.
 
--- Begin Message --- 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.
  --- End Message ---

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]