The Phobos Put
ag0aep6g
anonymous at example.com
Wed Mar 29 20:29:24 UTC 2023
On Wednesday, 29 March 2023 at 19:49:47 UTC, Ali Çehreli wrote:
> I thought Salih was proposing two more overloads to the
> existing put(). When I copy the existing put(), which takes
> 'ref R', not R[], then the code does not compile:
>
> auto put(R)(R[] range, R[] source)
> => putImpl(range, source);
>
> auto put(R)(ref R[] range, R[] source)
> => putImpl(range, source);
>
[...]
>
> void put(R, E)(ref R r, E e)
> {
> // This is from Phobos <-------
> }
I understand Salih's ref `put` to be same as yours: a stand-in
for the one that is already in Phobos. So he's proposing to add
the non-ref one.
But regardless of Salih's exact intent, the broader point is: a
non-ref overload could be added to Phobos. And that would enable
`a[1..$-1].phobos_put([2, 3])`. Which is what he asked about
originally.
More information about the Digitalmars-d-learn
mailing list