Hello,

 

I’m trying to use boost::ptr_vector with constant members, like

 

// Excerpt 1

boost::ptr_vector<const int> myVector;

myVector.push_back(new int(5));            //This line fails, see comment below

myVector[1] = 7;                                    //This should fail, can’t assign to const

 

 

I can do the following with boost::shared_ptr, which is the effect I’m trying to achieve with the above

 

// Except 2

boost::shared_ptr<const int> intPtr(new int(5));

intPtr* = 7;                                            //This won’t compile, can’t assign to const

 

 

Returning to excerpt 1, the second line fails, and I don’t know why. It causes an error deep within the bowels of the boost. I’ve tried many permutations placing const in different places, with no luck.

 

Any help or suggestions greatly appreciated!

 

 

 

Cheers,

 

Josh Quigley.