Boost logo

Boost Users :

Subject: Re: [Boost-users] [proto] char vs. int behaviour when matching
From: Eric Niebler (eric_at_[hidden])
Date: 2009-09-02 16:51:01


Maurizio Vitale wrote:
> Proto behaves in a different way when matching terminal<char> and
> terminal<int>.
> The only difference I'm aware is that it is implementation defined
> whether 'char' means 'signed char' or 'unsigned char' but it has to mean
> one of the two.
<snip>

That's where you're mistaken. char, signed char and unsigned char are 3
distinct types.

#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/assert.hpp>

int main()
{
   // char is not signed char or unsigned char
   BOOST_MPL_ASSERT_NOT((boost::is_same<char, signed char>));
   BOOST_MPL_ASSERT_NOT((boost::is_same<char, unsigned char>));

   // but int is signed int
   BOOST_MPL_ASSERT((boost::is_same<int, signed int>));
}

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net