www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Making emplaceRef public

reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
Why isn't `std.conv.emplaceRef` public when `std.conv.emplace` is?

AFAICT,

emplaceRef(x, ...)

is a bit more  safe than

emplace(&x, ...)

...
Apr 06 2018
parent Seb <seb wilzba.ch> writes:
On Friday, 6 April 2018 at 17:46:26 UTC, Per Nordlöw wrote:
 Why isn't `std.conv.emplaceRef` public when `std.conv.emplace` 
 is?

 AFAICT,

 emplaceRef(x, ...)

 is a bit more  safe than

 emplace(&x, ...)

 ...
I had the same thoughts too: https://issues.dlang.org/show_bug.cgi?id=18701 We can even do this without introducing a new symbol, but simply let emplace accept pointers and ref like we need with formattedRead for nice backwards compatibility.
Apr 06 2018