known duplicate code
Peter Doerfler
gcc@pdoerfler.com
Thu Sep 14 08:49:00 GMT 2006
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
More information about the Libstdc++
mailing list