Opened 18 years ago

Last modified 12 years ago

#386 closed Bugs (fixed)

boost::pool_allocator breaks with vector of vectors — at Initial Version

Reported by: glr9940 Owned by: shammah
Milestone: Component: pool
Version: None Severity: Problem
Keywords: Cc:

Description

The resulting executable built with the following code 
under GCC 3.3.5 produces a segmentation fault when 
run:

Note that switching the definition of EventVector to use 
a vector with a standard allocator will fix the problem.

Also note that the definition of IndexVector doesn't seem 
to matter.

#include <boost/pool/pool_alloc.hpp>
#include <vector>
#include <iostream>

template <typename DataType>
struct PooledVector {
       typedef std::vector<DataType, 
boost::pool_allocator<DataType> >      Type;
};

typedef PooledVector<int>::Type EventVector;
//typedef std::vector<int>      EventVector;

//typedef PooledVector<EventVector>::Type       
IndexVector;
typedef std::vector<EventVector>        IndexVector;

int main() {
               IndexVector iv;
               iv.push_back(EventVector());
               iv.back().push_back(3);
               std::cout << "it works\n";
       return 0;
}

Change History (0)

Note: See TracTickets for help on using tickets.