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);
}

Reply via email to