added conversions from non-pool-allocator containers

release/4.3a0
Alex Cunningham 2012-07-02 19:54:32 +00:00
parent 15b3dd9d5f
commit c37237e43b
2 changed files with 20 additions and 2 deletions

View File

@ -50,9 +50,18 @@ public:
/** Copy constructor from another FastList */
FastList(const FastList<VALUE>& x) : Base(x) {}
/** Copy constructor from the base map class */
/** Copy constructor from the base list class */
FastList(const Base& x) : Base(x) {}
/** Copy constructor from a standard STL container */
FastList(const std::list<VALUE>& x) {
// This if statement works around a bug in boost pool allocator and/or
// STL vector where if the size is zero, the pool allocator will allocate
// huge amounts of memory.
if(x.size() > 0)
Base::assign(x.begin(), x.end());
}
private:
/** Serialization function */
friend class boost::serialization::access;

View File

@ -66,11 +66,20 @@ public:
Base(x) {
}
/** Copy constructor from the base map class */
/** Copy constructor from the base set class */
FastSet(const Base& x) :
Base(x) {
}
/** Copy constructor from a standard STL container */
FastSet(const std::set<VALUE>& x) {
// This if statement works around a bug in boost pool allocator and/or
// STL vector where if the size is zero, the pool allocator will allocate
// huge amounts of memory.
if(x.size() > 0)
Base::insert(x.begin(), x.end());
}
/** Print to implement Testable */
void print(const std::string& str = "") const { FastSetTestableHelper<VALUE>::print(*this, str); }