Patch: stl_vector.h and vector.tcc

Dhruv Matani dhruvbird@gmx.net
Mon Jul 12 13:10:00 GMT 2004


Hi,
	This patch optimizes std::vector<> for Swappable types. Ones that can
be swapped in constant time, like std::vector<> itself, and where swap
is not defined in terms of assignment.

Also, attached is a test case, which tries to detect possible errors in
the new code, and also some performance routines, that give a fair idea
of how much improvement the patch has brought about for some fairly
common cases.

The file stl_type_traits.h needs to be copied to the include/bits folder
for the correct operation of this patch.

-- 
        -Dhruv Matani.
http://www.geocities.com/dhruvbird/

As a rule, man is a fool. When it's hot, he wants it cold. 
When it's cold he wants it hot. He always wants what is not.
	-Anon.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.stl_vector.12072004.dhruv
Type: text/x-patch
Size: 7354 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040712/59bbaeb2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.vector.tcc.12072004.dhruv
Type: text/x-patch
Size: 24424 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040712/59bbaeb2/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stl_type_traits.h
Type: text/x-c-header
Size: 724 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040712/59bbaeb2/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vec_vec_test.cpp
Type: text/x-c++
Size: 4855 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040712/59bbaeb2/attachment-0003.bin>


More information about the Libstdc++ mailing list