Article View: comp.std.c++
Article #2569Re: Some questions about standard library
From: Beman Dawes
Date: Wed, 15 Nov 1995 01:29
Date: Wed, 15 Nov 1995 01:29
28 lines
1738 bytes
1738 bytes
fresl@master.grad.hr (Kresimir Fresl) writes: >I have few questions (or maybe themes for discussion) about some >design decisions in standard library. I started to read articles in >comp.std.c++ only recently, so maybe some of them were already discussed. > >1. `struct pair <T1, T2>' has only one constructor: > pair(const T1& x, const T2& y). > As far as I know, compiler can generate copy constructor, but, > because there is one constructor, it can't generate default > constructor. > > But then you can not do this: > vector < pair <int, int> > v (5); > because first default argument of constructor for `vector<T>' is a call > to default constructor of T. Some other `vector' member functions also > expect default constructor of T. So, I think that `pair' should also have > default constructor. A default constructor for pair<> was added by the committee last week in Tokyo. --Beman Dawes (beman@dawes.win.net) --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<1104@dawes.win.net>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 15 Nov 95 01:29:13 GMT Approved: fjh@cs.mu.oz.au Organization: - Newsgroups: comp.std.c++ X-Mailer: WinNET Mail, v2.51 Message-ID: <1104@dawes.win.net> Reply-To: beman@dawes.win.net (Beman Dawes) X-Original-Date: Tue, 14 Nov 1995 14:12:04 Subject: Re: Some questions about standard library From: beman@dawes.win.net (Beman Dawes) X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMKlCg+EDnX0m9pzZAQHfGQGAmlDZRSfEiozYZ7V0A6b6OnPc5+eoE+3a Fox1r7XJtrWQvBSRBuFAYjPEbndcjRo8 =n0Np