I wrote a function
void addAnything(T const &obj)
{
...
m_list.push_front(obj); // - line returns C2664 - list is initialized by std::list<T*> m_list
...
}
and my Problem is to convert from ‘const T’ in ‘T *const’. And I need to insert it into this list… =/ Any method for inserting elements into a std::list requires ‘const T& x’.
Is there any way to insert an const item into my list and keep the parameter of addAnything()?
Maybe by adapting m_list?
Thx for any advice!
Are you aware of std::list<T*> definition? Manually you should delete object when is removed from the list.
I not than replace std::list<T*> with std::list<T>.