friends with phobos, workaround?
Daniel N via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Sep 9 13:19:43 PDT 2015
For the record, I think D made the right decision... omitting
friends.
However there's one case in particular which I find useful,
anyone see a good workaround for this?
#include <memory>
class Friendly
{
private:
int val;
Friendly(int&& val) : val(val) {}
friend std::unique_ptr<Friendly>
std::make_unique<Friendly>(int&& val);
};
int main()
{
auto yay = std::make_unique<Friendly>(1);
auto nay = new Friendly(1);
}
More information about the Digitalmars-d-learn
mailing list