Hi,
I may be overlooking the obvious here, but I can't seem to find an
easy way to match terminals containing a pointer to a function (of
arbitrary type). The basic use case is this:
I have some grammars that contain specific rules for terminals used as
a function in certain cases, something along the lines of:
boost::proto::when
boost::proto::functionSFFieldVariables, MappedCoordinate,
MyPrimitiveTransform(...)
However, further along in the sequence of grammars, I want to provide
a fall-back for normal functions, which are evaluated using the
default grammar. This makes defining standard functions such as sin,
cos, ... very easy. Right now, I am matching those like this:
boost::proto::function boost::proto::_, boost::proto::varargGrammarT
where GrammarT corresponds to whatever grammar is currently in use
(it's a template parameter for my default operations fall-back).
The problem with this is, is that it also matches
boost::proto::functionSFFieldVariables, GrammarT, which is incorrect
for anything except if GrammarT happens to be a MappedCoordinate. So
what I'd like to do, is limit my fall-back grammar to only match
functions with child 0 being a function pointer terminal, such as
static boost::proto::terminal double(*)(double) ::type const _sin = {sin};
And this for any possible function signature. Is there an (easy) way to do this?
Cheers,
--
Bart
___
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto