
LionAM wrote:
Or another question: Why is ptr_vector _much_ slower than std::vector?
It brings in a number of headers *in addition to* <vector>. (<memory> and numerous boost headers for meta-programming and serialization). Furthermore, it require a litle bit meta-programming to allow the specific ptr_vector< nullable<T> > syntax. On visual C++ 8 I get (2.1 Ghz P3 CPU, 7200RPM harddisk): $ time cl /EHsc ptr_vector.cpp /I../boost/boost Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. ptr_vector.cpp Microsoft (R) Incremental Linker Version 8.00.50727.42 Copyright (C) Microsoft Corporation. All rights reserved. /out:ptr_vector.exe ptr_vector.obj real 0m1.652s user 0m0.015s sys 0m0.031s For this sample program: #include <boost/ptr_container/ptr_vector.hpp> int main() { boost::ptr_vector<int> vec; vec.push_back( new int(42) ); return vec.size(); } With precompiled headers it can be much lower. Also note that a slow/unordered harddisk can affect compilation speed significantly. -Thorsten