Questions tagged [pointer-container]

7 questions
4
votes
2 answers

Pointer to an element in boost pointer container

I am just starting to use boost::ptr_vector. I have a ptr_vector pctr as a member of one class A and want another class B to refer to an element in pctr. While constructing an object of class B I want to store a pointer in pctr. Since pointer…
amit kumar
  • 20,438
  • 23
  • 90
  • 126
1
vote
2 answers

C++: Problem with ptr_multimap::insert

Please consider the following code: #include "boost/ptr_container/ptr_map.hpp" int main() { typedef boost::ptr_multimap M; M m; char c = 'c'; int* j = new int(7); m.insert(c, j); …
amit kumar
  • 20,438
  • 23
  • 90
  • 126
1
vote
0 answers

how to expose boost::ptr_multimap to python?

I am trying to expose a global boost::ptr_multimap that lives in the c++ world to python. As the released boost::python suite doesn't include support for multimap, I have cloned code from…
MMM
  • 910
  • 1
  • 9
  • 25
1
vote
1 answer

boost pointer container insert (ptr_list)

For some reason, I cannot get ptr_list to insert elements. boost::ptr_list somelist; int *someint = new int(123); int *someint2 = new int(456); somelist.push_back(someint); boost:: ptr_list::iterator i =…
Andrew
  • 2,309
  • 4
  • 27
  • 42
0
votes
3 answers

dynamic_cast reference to base class in stl container

Is it possible to store a bunch of objects by their base class in say an std::list without pointers. I would really like the objects to be held in the container, then retrieve a pointer to the object in the container and dynamic_cast it to correct…
ptpaterson
  • 9,131
  • 4
  • 26
  • 40
0
votes
2 answers

Invoking the copy constructor of a base class for boost pointer containers?

For the below code, when v is copied, the members of Model class do not get copied. #include #include using namespace std; class SomeNewClass { public: int a; }; class…
Nav
  • 19,885
  • 27
  • 92
  • 135
0
votes
1 answer

Is there a priority_queue adaptor for boost pointer containers?

Is there a priority_queue adaptor that works with boost pointer containers?
amit kumar
  • 20,438
  • 23
  • 90
  • 126