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 

C++0x container constructors for DefaultConstructible object

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





PostPosted: Mon May 21, 2007 7:04 am    Post subject: C++0x container constructors for DefaultConstructible object Reply with quote



I notice in the draft N2284 that sequence containers have had one
constructor split in two. We now have (for list<T>):

explicit list(size_type n);
list(size_type n, const T& value, const Allocator& = Allocator());

How come the first type of constructor doesn't take an allocator
parameter?



Bo Persson


---
[ 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.comeaucomputing.com/csc/faq.html ]
Back to top
Howard Hinnant
Guest





PostPosted: Mon May 21, 2007 8:59 pm    Post subject: Re: C++0x container constructors for DefaultConstructible ob Reply with quote



In article <5b91g3F2rt1iiU1 (AT) mid (DOT) individual.net>,
bop (AT) gmb (DOT) dk ("Bo Persson") wrote:

Quote:
I notice in the draft N2284 that sequence containers have had one
constructor split in two. We now have (for list<T>):

explicit list(size_type n);
list(size_type n, const T& value, const Allocator& = Allocator());

How come the first type of constructor doesn't take an allocator
parameter?

Mainly just history. People have never been able to say:

std::list<T, A> c(n, A());

And I've never heard any requests for that functionality. So I didn't
add it. It easily could be added. Is there demand for it? Would you
be willing to write a short paper or defect report with detailed
proposed wording relative to N2284?

-Howard

---
[ 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.comeaucomputing.com/csc/faq.html ]
Back to top
Bo Persson
Guest





PostPosted: Tue May 22, 2007 3:44 am    Post subject: Re: C++0x container constructors for DefaultConstructible ob Reply with quote



Howard Hinnant wrote:
:: In article <5b91g3F2rt1iiU1 (AT) mid (DOT) individual.net>,
:: bop (AT) gmb (DOT) dk ("Bo Persson") wrote:
::
::: I notice in the draft N2284 that sequence containers have had one
::: constructor split in two. We now have (for list<T>):
:::
::: explicit list(size_type n);
::: list(size_type n, const T& value, const Allocator& = Allocator());
:::
::: How come the first type of constructor doesn't take an allocator
::: parameter?
::
:: Mainly just history. People have never been able to say:
::
:: std::list<T, A> c(n, A());
::
:: And I've never heard any requests for that functionality. So I
:: didn't add it. It easily could be added. Is there demand for it?
:: Would you be willing to write a short paper or defect report with
:: detailed proposed wording relative to N2284?
::

I was really just curious about why one constructor breaks the
pattern. Having already written a defect report for for strings
(#614), I noticed that other containers now also deviate from the
container requirements in 23.1/9, where it says that constructors
should all take an Allocator& argument. Except when they don't?

I can also guess that the new constructor should default construct the
container's allocator member, but haven't found that it says so
anywhere. Did I miss this requirement, or is it just obvious anyway?


Bo Persson


---
[ 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.comeaucomputing.com/csc/faq.html ]
Back to top
Pete Becker
Guest





PostPosted: Tue May 22, 2007 3:45 am    Post subject: Re: C++0x container constructors for DefaultConstructible ob Reply with quote

Howard Hinnant wrote:
Quote:
In article <5b91g3F2rt1iiU1 (AT) mid (DOT) individual.net>,
bop (AT) gmb (DOT) dk ("Bo Persson") wrote:

I notice in the draft N2284 that sequence containers have had one
constructor split in two. We now have (for list<T>):

explicit list(size_type n);
list(size_type n, const T& value, const Allocator& = Allocator());

How come the first type of constructor doesn't take an allocator
parameter?

Mainly just history. People have never been able to say:

std::list<T, A> c(n, A());

And I've never heard any requests for that functionality. So I didn't
add it. It easily could be added. Is there demand for it? Would you
be willing to write a short paper or defect report with detailed
proposed wording relative to N2284?


Please, not a "defect report." Defect reports apply only to published
standards, and they invoke a formal response process.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)

---
[ 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.comeaucomputing.com/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.