[Issue 6495] array(file.byLine()) is a problem
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 16 13:28:30 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6495
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #3 from bearophile_hugs at eml.cc 2012-10-16 13:28:26 PDT ---
One solution to avoid this problem is to modify byLine to perform a copy on
default and not perform it on request:
auto file = File("foo.txt", "r");
auto lineBuff = array(file.byLine());
==> good
auto file = File("foo.txt", "r");
auto lineBuff = array(file.byLine!false());
==> does't copy, lineBuff contains garbage
This makes the code safe (but a little slower) on default, when you don't know
what you are doing, and offers a simple way to have faster code when you know
what you are doing and you know you don't want a copy (this ides also follows
the general safety philosophy of D).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list