http://d.puremagic.com/issues/show_bug.cgi?id=6495


bearophile_h...@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_h...@eml.cc


--- Comment #3 from bearophile_h...@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: -------

Reply via email to