Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] grammar matching terminal or pointer to terminal
From: Eric Niebler (eric_at_[hidden])
Date: 2009-09-28 15:52:36


joel wrote:
> I need to have a proto grammar that matches char, float or any pointer
> to either char or float.

What do you mean, any pointer? Do you mean, any level of indirection,
like float****? Ignoring cv-qualifiers at all levels of indirection?

> I tried :
>
> struct cfptr :
> or_< terminal<char>
> , terminal<short>

Do you mean float here or short?

> , and_< cfptr

You have infinite recursion here. An expression matches cfptr if <stuff>
OR it matches cfptr and <stuff>.

> , if_< is_pointer< remove_pointer< bp::value_>() >() >

There is no bp::value_. You probably mean bp::_value.

> > {};
>
> but it faisl to compile when i do :
>
> cout << matches< typename terminal<short>::type, cfptr>::value ;
>
> by telling me short is not a class or union.
>
> should I cut this in two parts or is there a way to do this in one shot?

I don't know. Try telling me again what you're trying to do.

-- 
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