Boost logo

Boost :

From: Chris Jefferson (caj_at_[hidden])
Date: 2005-01-31 12:56:16


While this isn't strictly related to the development of boost, I believe
it may be interesting to developers of boost, and I would also be very
interested in hearing any opinions (good and bad) from users and
developers of boost.

I am currently in the process of implementing all applicable (sort,
rotate, partition, etc..) functions in the C++ standard library using
only calls to iter_swap. Obviously for those classes with expensive
copies and cheap swaps (list, vector, map, set, etc) this is a big win,
however it unfortunatly can be slightly slower for classes and types
which fall on the basic definition of swap. Therefore there will be an
implementation-specific type trait defined (name to be decided) which
can be defined to enable the swapping versions of functions.

I'm implementing much of this for my own personal usage, but I hope to
submit the code to libstdc++-v3 (g++'s implementation of the c++
standard library). While this may not be quite as general as the ideas
of "move symantics", it has the advantage of being implementable now,
and providing some significant improvements.

I would be interested in knowing if anyone has any comments, and also
should such code be implemented in g++ if boost would be willing to add
the compiler-specific extra information to mark any classes with
efficent swap as such.

Note: I am aware there are various ways of trying to approximate if
someone has specialised swap, such as checking for a swap member
function. However at least at first, it is my belief such a library
should probably be strictly op-in.

Thank you,

Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk