C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Standard signature for allocator destructor?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
apm
Guest





PostPosted: Fri Sep 17, 2004 4:26 pm    Post subject: Standard signature for allocator destructor? Reply with quote



My reading of the std is that the signature of a custom allocator
should follow the pattern laid out by the default allocator.

Section 20.1.5 (page 354) says that the std library lays down the
requirements for allocators. The requirements are in table 32 (page
356). However, the table does not specify signatures for the allocator
constructor or destructor. It is reasonable to assume (IMO) that the
signatures should follow the form of the default allocator in section
20.4.1. I cannot find anywhere in the std where it actually says this
though.

This causes a serious problem: if one inherits from a custom allocator
that DOES conform to the default allocator dtor signature then the
derived class must also have a dtor with an empty throw list.
Otherwise a compilation error can result (not all compilers watch out
for this but some definitely do). This issue just caused a compilation
error in some code I am working on. So it is a real problem.

Suppose the derived class had been written by someone else. And that
it could not be changed. Then I would have to change the signature of
my allocator dtor so as NOT to conform to the pattern laid out in
section 20.4.1 to make the compilation error go away. But I feel that
this change makes me violate the std. Except that the std seems to be
a little grey in this area. Can anyone shed any light please? I would
like to tell the author of the derived class that he has to change
because I am conformant and he is not. But its hard to do that when
the std doesnt seem to cover it completely.

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.