Guest User

Untitled

a guest
May 9th, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Errors in std::make_shared() when trying to make shared_ptr?
  2. class Foobar {
  3. public:
  4. Foobar(Baz* rBaz);
  5.  
  6. private:
  7. Foobar();
  8. }
  9.  
  10. Baz* myBaz = new Baz();
  11. std::shared_ptr<Foobar> sharedFoo = std::make_shared<Foobar>(new Foobar(myBaz));
  12.  
  13. error C2664: 'Foobar::Foobar(const Foobar &)' : cannot convert parameter 1 from 'Foobar *' to 'const Foobar &'
  14. 3> Reason: cannot convert from 'Foobar *' to 'const Foobar'
  15.  
  16. std::shared_ptr<Foobar> sharedFoo = std::make_shared<Foobar>(myBaz);
Advertisement
Add Comment
Please, Sign In to add comment