[Issue 12512] Feature request: cdup

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 13 04:30:14 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12512

--- Comment #3 from monarchdodra at gmail.com ---
(In reply to monarchdodra from comment #2)
> (In reply to comment #1)
> > Shouldn't dup just give you const(T)[] when it can't manage T[] ?
> 
> That would also work for me I guess.

Just to be clear, my need is:
Given a type T (which may be qualified), I need a function that can do this:

//----
T[] output = intput.someDup();
//----

Currently, this is not possible in generic code, even with static ifs to switch
between dup/idup.

The current workaround right now, is to use `array` instead. It works, but
isn't as efficient for arrays (it's specialized for RA only). That said, I
could just improve the implementation for arrays...

--


More information about the Digitalmars-d-bugs mailing list