phobos
phobos copied to clipboard
emplace doesn't warn about private constructors
emplace could do a much better job of detecting the reasons for failure, but this seems like an obvious one (though the check isn't entirely trivial because you have to find the right ctor and check its visibility)
I wouldn't worry too much. emplace will be deleted soon!
In my emplace implementation [1], the way I handle this is by just calling the constructor without trying to check first whether it will succeed. If it works, great; if it doesn't, you get the error message straight from the compiler.
[1] https://github.com/pbackus/allocator-demo/blob/master/src/pbackus/lifetime.d