From: A. McKenney on 3 May 2010 16:44 On May 1, 4:26 pm, Goran <goran.pu...(a)gmail.com> wrote: <snip> > OK, but there's nothing wrong in throwing from a constructor. ... To go off on a tangent, what's the case with array constructors? If you have T tarray[100]; and the constructor for tarray[50] throws, 1. will t[51:99] _not_ be constructed? 2. will the destructors for tarray[0:49] be called? It would make sense for this to happen, but, as others have pointed out, C++ behavior isn't always intuitively obvious. I'd feel better if a C++ standards Guru explicitly said, "yes" to both. (Actually, none of my C++ books is a good reference for the nooks and crannies of exceptions and templates; I've mostly had to learn by experiment. If we're lucky, maybe Scott M. will come out with a "Nooks and Crannies of C++" to complement his "Effective" series. Maybe more like "Nooks and Crannies of C++, 2010", "N&CoC++, 2011", etc.) -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
|
Pages: 1 Prev: What's the summary of N2855 - Rvalue References and Exception Safety? Next: U++ 2361 released |