Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.49 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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);