Patch for stl_tree.h and cpp_type_traits.h.
Dhruv Matani
dhruvbird@gmx.net
Tue Feb 17 13:17:00 GMT 2004
This patch basically applies the same things to the rb_tree as the other
container + one more thing which is to detect whether the comparison
function is actually a function or an optimizable struct/class which can
be derived from, and does accordingly. Also, the __is_pod struct has
been changed. I have however (without telling anyone!) introduced a new
namespace, which might not always be a welcome change. It's called
__gnu_type_traits, because I could not find another way out! The
compiler was not ready to accept the code when I put it inside the class
__is_pod!??? If anyone has any objections/other better ideas, the
namespace will be removed. (As it is I do not control what gets merged!)
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
-------------- next part --------------
2004-02-17 Dhruv Matani <dhruvbird@gmx.net>
* bits/cpp_type_traits.h: Changed __is_pod completely. Now, it
does not use any of the previous type_traits to detect the pod
types, and it also detects function pointers as POD types.
* bits/stl_tree.h: Introduced a new class _Rb_tree_impl, which
encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the
rb_tree, which was not conforming. This _Rb_tree_impl class is
also specialized on whether the _Compare parameter is a POD
type or not. If so, then it maintains the comparison function
as a data member, otherwise it makes the _Compare parameter a
base class of itself. Also, _M_key_compare is now a function
instead of a data member, so that the above trick can work
properly. Delegated the initialization of the other data members to
this newly created class. Also, now other member functions of rb_tree
must refer to _M_key_compare as _M_impl._M_key_compare(). The
other data members (*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.dhruv.17022004
Type: text/x-patch
Size: 25021 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040217/33efd486/attachment.bin>
More information about the Libstdc++
mailing list