nkzxw / ontl

Automatically exported from code.google.com/p/ontl
0 stars 0 forks source link

Should we allocate memory for std::string("")? #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
subj.

Current implementation do not allocates any memory (begin() == data() == 
nullptr).

Original issue reported on code.google.com by icestudent@gmail.com on 5 Apr 2011 at 7:08

GoogleCodeExporter commented 9 years ago

Original comment by icestudent@gmail.com on 5 Apr 2011 at 10:52

GoogleCodeExporter commented 9 years ago
Why? It seems to be unnecessary.

Original comment by ntl.supp...@gmail.com on 6 Apr 2011 at 11:02

GoogleCodeExporter commented 9 years ago
There is no difference currently between std::string s1 and s2("").

Original comment by icestudent@gmail.com on 6 Apr 2011 at 12:07

GoogleCodeExporter commented 9 years ago
For explicit memory allocation std::string("", 1) should be used.
Issue resolved.

Original comment by icestudent@gmail.com on 8 Apr 2011 at 10:11