I have a standard linked list in template format (with T being the typename) with the following relevant insertion operators:
bool PushFront (const T& t); // Insert t at front of list
bool PushBack (const T& t); // Insert t at back of list
I want to build a list of pointers to objects (we'll call them objects of class Box for simplicity) that is member data for a parent class (we'll call that class Warehouse). However, I want to have a constant Box
const Box INVISIBLE_BOX = Box();
that represents a nonexistent Box. However, I cannot use either
1 2 3
to add INVISIBLE_BOX to the list of boxes without getting an invalid conversion error
invalid conversion from âconst warehouse::Box*â to âwarehouse::Box*â [-fpermissive]
What can I do to make it take a constant Box?
I am using g++ to compile these files.