[Xpressive] Placeholder for user defined assertion
I am trying to use a placeholder object for the check function in an xpressive regex.
The error I usually get is "error C2064: term does not evaluate to a function taking 1 arguments"
Please see my example below that uses the three_or_six user-defined assertion as described at http://www.boost.org/doc/libs/1_51_0/doc/html/xpressive/user_s_guide.html#bo....
I am using boost 1.51 and Visual Studio 2010 Express.
This is a contrived example; the real reason I am trying to do this is because my assertion has state that is not known at the time the regex is compiled. In the interim I have worked around it by using static variables instead of placeholders but that makes for more brittle code than I would like.
Also, is there any way to reuse the match_results objects that are created by the iterator syntax?
Thanks,
Michael Mitchell
//Inspired by https://groups.google.com/forum/#!topic/boost-list/hTBAT7KMgd4
#include <iostream>
#include
On 5/14/2014 9:59 AM, LOL wrote:
I am trying to use a placeholder object for the check function in an xpressive regex. The error I usually get is "error C2064: term does not evaluate to a function taking 1 arguments"
Please see my example below that uses the three_or_six user-defined assertion as described at http://www.boost.org/doc/libs/1_51_0/doc/html/xpressive/user_s_guide.html#bo....
I am using boost 1.51 and Visual Studio 2010 Express.
You can't use a placeholder in an assertion like that, sorry. But see below.
This is a contrived example; the real reason I am trying to do this is because my assertion has state that is not known at the time the regex is compiled. In the interim I have worked around it by using static variables instead of placeholders but that makes for more brittle code than I would like.
What you can do I use by_ref to embed one regex by reference into another. That way, your outer regex can be defined up front, and the inner regex can be assigned later, once the user-defined assertion is known. Alternatively, your user-defined assertion can store its data in an impl that gets filled in later. Hope that helps, -- Eric Niebler Boost.org http://www.boost.org
participants (2)
-
Eric Niebler
-
LOL