[Issue 18701] New: std.conv.emplaceRef should be made publicly available
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 31 19:26:02 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18701
Issue ID: 18701
Summary: std.conv.emplaceRef should be made publicly available
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: bootcamp, safe
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: greensunny12 at gmail.com
std.conv.emplaceRef is Phobos's internal @safe version of emplace.
Like `formattedRead`, emplace should be made @safe if no pointers are used.
Motivation:
No need for these hacks anymore - just `emplace!SafeClass(buf, 5)`
---
auto support = (() @trusted => cast(SafeClass)(buf.ptr))();
auto safeClass = emplace!SafeClass(support, 5);
---
--
More information about the Digitalmars-d-bugs
mailing list