Topic: Some questions about standard library


Author: beman@dawes.win.net (Beman Dawes)
Date: 1995/11/15
Raw View
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. ]