How to make boost::make_shared a friend of my class

后端 未结 6 1337
借酒劲吻你
借酒劲吻你 2021-02-03 12:28

I have written a class with protected constructor, so that new instances can only be produced with a static create() function which returns shared_ptr\'s to my class. To provide

6条回答
  •  不思量自难忘°
    2021-02-03 13:10

    I would try without the template part. After all, you want a specific instantiation of the (template) function to be a friend of your class, aren't you? Does

    friend boost::shared_ptr boost::make_shared(const ConnectionManagerPtr&, const std::string&);
    

    work?

    If that's not the solution, it might be helpful to give us the compiler messages you're getting ...

提交回复
热议问题