www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18701] New: std.conv.emplaceRef should be made publicly

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 puremagic.com
          Reporter: greensunny12 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);
---

--
Mar 31 2018