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.