Пример #1
0
 	Collection* generate() {
 		CollectionType *result = new CollectionType(numa::util::MmapAllocator<T>(thisBase()->from()));
 		result->reserve(thisBase()->elements());
 		for (int i = 0; i < thisBase()->elements(); i++) {
 			result->push_back(thisBase()->construct());
 		}
 		return new Collection(result);
 	}
Пример #2
0
 	void migrate(Collection *c) {
 		// build new collection, with newly constructed members
 		CollectionType *newcol = new CollectionType(numa::util::MmapAllocator<T>(thisBase()->to()));
 		CollectionType &old = **c;
 		newcol->reserve(old.size());
 		
		for (size_t i = 0; i < old.size(); i++) {
 			newcol->push_back(T(old[i]));
 		}
 		
 		delete *c;
 		*c = newcol;
 	}