boost::ptr_vector does not support const types
I would like to use a ptr_vector to hold a number of const values but it
seems ptr_vector does not currently support the use of const value types.
See this simple code example:
#include "boost/ptr_container/ptr_vector.hpp"
#include <vector>
class X
{
const int i;
public:
X(int i) : i(i) {}
int getI() const { return i; }
};
int main()
{
boost::ptr_vector<X> bvx;
boost::ptr_vector<const X> bvcx;
std::vector
On 18-08-2015 09:35, Martin Gamwell Dawids wrote:
Is there another workaround for this or have I overlooked something?
I don't think there is a workaround. There was a fix for this in the old trunk branch, but I don't know if it has been merged to the release branch. regards -Thorsten
Is there another workaround for this or have I overlooked something?
I don't think there is a workaround. There was a fix for this in the old trunk branch, but I don't know if it has been merged to the release branch.
Not being familiar with boost development, could you give me a pointer to the fix in the old trunk branch? Then I could have a look in the git repo to see if the fix exists there or otherwise create a pull request. Regards, Martin
On 24-08-2015 14:37, Martin Gamwell Dawids wrote:
Is there another workaround for this or have I overlooked something?
I don't think there is a workaround. There was a fix for this in the old trunk branch, but I don't know if it has been merged to the release branch.
Not being familiar with boost development, could you give me a pointer to the fix in the old trunk branch? Then I could have a look in the git repo to see if the fix exists there or otherwise create a pull request.
I think it was a bunch of const_cast internally. regards -Thorsten
participants (2)
-
Martin Gamwell Dawids
-
Thorsten Ottosen