Jump to content

Recommended Posts

Posted

I'm converting a program to use std::vector < boost::shared_ptr >*instead of std::vector. The class use operator [] and with vector operator [] where written like this for the const an non const function:

 

const T* MyClass::operator[](const unsigned int index) const

{

***...

***return m_myList[index];

}

 

T* MyClass::operator[](const unsigned int index)

{

***return const_cast(static_cast(*this)[index]);

}

 

I am unable to convert the non const operator[] to use shared_ptr.

 

Thanks.

 

More...

 

View All Our Microsoft Related Feeds

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...