|
Boost Users : |
Subject: [Boost-users] [proto] char vs. int behaviour when matching
From: Maurizio Vitale (maurizio.vitale_at_[hidden])
Date: 2009-09-02 16:28:10
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. I was surprised to hit the following:
struct char_grammar : proto::or_<
proto::terminal<signed char>,
proto::terminal<unsigned char>
>
{};
struct extended_char_grammar : proto::or_<
proto::terminal<char>,
proto::terminal<signed char>,
proto::terminal<unsigned char>
>
{};
struct int_grammar : proto::or_<
proto::terminal<signed int>,
proto::terminal<unsigned int>
>
{};
int main()
{
// WHY _NOT?
BOOST_MPL_ASSERT_NOT ((proto::matches<proto::terminal<char>, char_grammar>));
BOOST_MPL_ASSERT ((proto::matches<proto::terminal<char>, extended_char_grammar>));
// GIVEN THAT:
BOOST_MPL_ASSERT ((proto::matches<proto::terminal<int>, int_grammar>));
return 0;
}
Is this behaviour intentional?
Regards,
Maurizio
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