Re: basic_string ctor
- From: "Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@xxxxxxxxxxxxxxx>
- Date: Tue, 17 May 2005 11:15:45 -0700
John wrote:
> Hi,
>
> Is it legal C++ (by which I mean according to the standard spec) to
> pass a null into a basic_string ctor? Or, more precisely, is it
> legal C++ to pass a null pointer into a basic_string parameter on a
> method?
No, it's not. The committee was worried about the cost of the extra if() in
the constructor being too high (misplaced premature optimization, IMO).
Many C++ library implementations will in fact crash if you pass null.
-cd
.
- Follow-Ups:
- Re: basic_string ctor
- From: Duane Hebert
- Re: basic_string ctor
- From: James Curran
- Re: basic_string ctor
- From: Stephen Howe
- Re: basic_string ctor
- References:
- basic_string ctor
- From: John
- basic_string ctor
- Prev by Date: basic_string ctor
- Next by Date: Re: basic_string ctor
- Previous by thread: basic_string ctor
- Next by thread: Re: basic_string ctor
- Index(es):