[Proto] grammar matching terminal or pointer to terminal
I need to have a proto grammar that matches char, float or any pointer to either char or float. I tried : struct cfptr : or_< terminal<char> , terminal<short> , and_< cfptr , if_< is_pointer< remove_pointer< 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? -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
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
Eric Niebler wrote:
I don't know. Try telling me again what you're trying to do. note to self: don't post without coffee first v_v
I should match : char, float, char*..* or float*..* , pointer being any level of indirection -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
joel wrote:
Eric Niebler wrote:
I don't know. Try telling me again what you're trying to do. note to self: don't post without coffee first v_v
I should match : char, float, char*..* or float*..* , pointer being any level of indirection
Try this:
#include
Eric Niebler wrote:
Try this: <snip>
OK that was my latest guess. I innocently thought i can combine calls to transform and use the recursive form of the grammar itself to iterate over iteration level. Thanks for the clarification
Joel Falcou wrote:
Eric Niebler wrote:
Try this: <snip>
OK that was my latest guess. I innocently thought i can combine calls to transform and use the recursive form of the grammar itself to iterate over iteration level.
You could, but that would be harder and take longer to compile. -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (3)
-
Eric Niebler
-
joel
-
Joel Falcou