This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: known duplicate code
- From: Peter Doerfler <gcc at pdoerfler dot com>
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 14 Sep 2006 10:49:38 +0200
- Subject: Re: known duplicate code
- References: <20060913181410.4d211cb0.bkoz@redhat.com>
Benjamin Kosnik wrote:
> Hey. I did a bit of code spelunking.
>
> Here are some duplicate code issues with current mainline:
>
> 1) mutex
> bitmap_allocator.h, libsupc++/guard.cc, concurrence.h
> I have a patch to unify this which I'll be posting shortly.
>
> 2) traits
> pb_ds, tr1 hashtable, tr1 traits vs. bits/cpp_type_traits, tr1 functional, looks like others
>
> 3) typelist
> pb_ds vs testsuite/typelist
>
> 4) exception_allocator
> pb_ds vs. testsuite
>
> Anything else that I've missed?
I've seen compile time type selection like
template <bool B, typename Then, typename Else>
struct IF
{
typedef Then type;
};
template <typename Then, typename Else>
struct IF<false, Then, Else>
{
typedef Else type;
};
in more than one place. Here is a partial list:
- ext/pb_ds/detail/type_utils.hpp
- ext/pb_assoc/detail/type_utils.hpp
- ext/typelist.h
- tr1/hashtable_policy.h
- tr1/random
Obviously, this is a very short piece of code and hard to get wrong, so
I'm not sure whether it's worth unifying.
It is similar in nature to __enable_if in bits/cpp_type_traits.h so I
guess if unified it should go there or does it have to be in ext?
I can write a patch if this is desired. What would be a good name?
Peter