known duplicate code

Benjamin Kosnik bkoz@redhat.com
Thu Sep 14 09:58:00 GMT 2006


> 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

Yep. This is what I was getting at with 2) traits. I think I've marked
up some of the duplicates in hash_policy. I would like to remove this
(and other) duplicates. There's also a conditional_type dupe, and some
others.

I'm trying to figure out what to do. One approach would to start an
ext/traits file, and dump stuff there.

-benjamin



More information about the Libstdc++ mailing list