26 Sep
2011
26 Sep
'11
7:06 p.m.
I'm using boost::shared_ptr, my class overloads the operator[]. How can I access to an element of a shared pointer? class myclass { public : operator[](std::size_t) } boost::shared_ptr<myclass> x( new myclass ); How can I get an access to the [] operator? I have tried it with (*x)[5] but I'll get a "segmentation fault" error
The syntax is correct. Ensure that shared_ptr "points" to a valid object, then debug your operator[].