How do I translate this bit of code from C(using pointers) to D?

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 26 14:27:22 PDT 2014


On Tue, Aug 26, 2014 at 08:58:13PM +0000, MacAsm via Digitalmars-d wrote:
> It maybe trivial to most of you but I don't know how do this avoiding
> string duplications. Can someone help me?
[...]
> in D, I can wrote as following:
[...]
> void move(int n)
> {
>   prev = str; // <- I want to avoid this string duplication did in every move() call

This does not duplicate the string. You may find this article helpful:

	http://dlang.org/d-array-article.html


T

-- 
Genius may have its limitations, but stupidity is not thus handicapped. -- Elbert Hubbard


More information about the Digitalmars-d mailing list