Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. boost:shared ptr in classes

boost:shared ptr in classes

Scheduled Pinned Locked Moved C / C++ / MFC
questioncom
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bernhard
    wrote on last edited by
    #1

    Hello, i would like to have a class with a shared pointer to some data. Data can be constructed with a structure astructure. So far the compiler is crashing, as soon as I try to access m_data. How do I have to implement this with using shared_ptr, or am I misusing the shared_ptr anyways ? Class1 { boost::shared_ptr m_data; public: Class1(); Class1(const astructure& source) Class1(const class1& source) } //I would like to generate Data with a data from the structure astructure Class1::Class1 (const astructure& source) { m_data.reset (new Data(astructure.m1, astructure.m2)); } //I would like to have a copy constructor Class1::Class1 (const Class1& source) { m_data = source.m_data; }


    All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
    Roger Wright
    http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx -- modified at 3:51 Monday 19th December, 2005

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups