added conversions from non-pool-allocator containers
parent
15b3dd9d5f
commit
c37237e43b
|
@ -50,9 +50,18 @@ public:
|
||||||
/** Copy constructor from another FastList */
|
/** Copy constructor from another FastList */
|
||||||
FastList(const FastList<VALUE>& x) : Base(x) {}
|
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) {}
|
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:
|
private:
|
||||||
/** Serialization function */
|
/** Serialization function */
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
|
|
|
@ -66,11 +66,20 @@ public:
|
||||||
Base(x) {
|
Base(x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Copy constructor from the base map class */
|
/** Copy constructor from the base set class */
|
||||||
FastSet(const Base& x) :
|
FastSet(const Base& x) :
|
||||||
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 */
|
/** Print to implement Testable */
|
||||||
void print(const std::string& str = "") const { FastSetTestableHelper<VALUE>::print(*this, str); }
|
void print(const std::string& str = "") const { FastSetTestableHelper<VALUE>::print(*this, str); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue