Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

boost shared_ptr

Posted on 2010-01-08
7
Medium Priority
?
781 Views
Last Modified: 2012-05-08
hi there!

i try to give a boost shared pointer a new Pointer, but it fails:
boost::shared_ptr<T>::reset' : 2 overloads have no legal conversion for 'this' pointer

anyone an idea?
this->_tbfCmdHandler.reset(new TbfCmdHandler()); 
Housekeeping::Facade &hk = Singleton<Housekeeping::Facade>::instance ();

hk.getTBFInstallation()->_tbfCmdHandlerPtr.reset(_tbfCmdHandler.get() );

Open in new window

0
Comment
Question by:olecb
  • 6
7 Comments
 

Author Comment

by:olecb
ID: 26208225
definition of tbfCmdHandler:
boost::shared_ptr<TbfCmdHandler>  _tbfCmdHandler
0
 
LVL 5

Accepted Solution

by:
nuke3dd earned 2000 total points
ID: 26208434
Maybe hk.getTBFInstallation()->_tbfCmdHandlerPtr is const and you can't reset it?
Is the error on line 1 or line 4?
0
 

Author Comment

by:olecb
ID: 26208451
sorry, "hk.getTBFInstallation()->_tbfCmdHandlerPtr" is not const.. :(
 the error occurs on line 4
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:olecb
ID: 26208453
sorry, "hk.getTBFInstallation()->_tbfCmdHandlerPtr" is not const.. :(
 the error occurs on line 4
0
 

Author Comment

by:olecb
ID: 26208616
another try: if i make the hk.getTBFInstallation()->_tbfCmdHandlerPtr   static
(static boost::shared_ptr<TBFControl::TbfCmdHandler> _tbfCmdHandlerPtr;)
I'm able to compile, but get these linker error:

16>tbfControl.lib(facade_impl.obj) : error LNK2001: unresolved external symbol "public: static class boost::shared_ptr<class TBFControl::TbfCmdHandler> Housekeeping::TBFInstallation::_tbfCmdHandlerPtr" (?_tbfCmdHandlerPtr@TBFInstallation@Housekeeping@@2V?$shared_ptr@VTbfCmdHandler@TBFControl@@@boost@@A)
0
 

Author Comment

by:olecb
ID: 26209834
anyone an idea?
0
 

Author Comment

by:olecb
ID: 26212000
the getTBFInstallation() function was const, that was the reason. nuke3dd gave the rigth hint:)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question