This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++0x vs. tr1 type_traits, round 1


On Apr 27, 2007, at 7:35 AM, Benjamin Kosnik wrote:


If there's anything I can do to help, I'm happy to. I'd be happy to post an implementation of make_(un)signed. It is essentially built out of type lists (one list for signed integral types and one list for unsigned integral types). bool, char and wchar_t, according to 3.9 are neither, though for sanity purposes, they do react to is_(un)signed in the intuitive fashion instead of according to 3.9. Perhaps this is what you are referring to as the algebra being off?

I posted a preliminary patch here: http://gcc.gnu.org/ml/libstdc++/2007-04/msg00160.html

Your help would certainly be most welcome!

Your patch is so prolific that I've only taken time to review make_unsigned. I will try to be more thorough as time allows. Thank you very much for the effort that you and everyone else is putting into this.


I starting building a rough test for make_unsigned and had the following failures for your implementation:

Oh, to get started I needed to make a minor tweak on access:

template<typename _Qualified, typename _Unqualified,
   bool _IsConst = is_const<_Qualified>::value,
   bool _IsVol = is_volatile<_Qualified>::value>
  struct __match_cv_qualifiers
  {
//  private:  // hh
    typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
    typedef typename __match::__type __type;
  };

Failed:

__static_assert<is_same<make_unsigned<unsigned char>::type, unsigned char>::value> t3;
__static_assert<is_same<make_unsigned<const wchar_t>::type, const unsigned>::value> t4;
__static_assert<is_same<make_unsigned<const unsigned>::type, const unsigned>::value> t5;


This one failed when compiled with -funsigned-char:

__static_assert<is_same<make_unsigned<char>::type, unsigned char>::value> t1;

Fwiw, I've posted a reference implementation (which has a lot of similarities to your patch) here:

http://home.twcny.rr.com/hinnant/cpp_extensions/make_signed.html

Hope this helps. And thanks again for your work on this.

-Howard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]