|
Boost : |
From: Lorenzo Bettini (bettini_at_[hidden])
Date: 2005-06-06 08:46:08
John Maddock wrote:
>>> Sorry, I'm being dense today: what do you mean by that?
>>
>>
>> instead of checking every what[i].matched as in the following
>>
>> for (unsigned int i = 1; i < what.size(); ++i) {
>> if (what[i].matched) {
>>
>> I'd like to be able to have the subexpressions that matched accessible
>> directly. Something like
>>
>> for (unsigned int i = 1; i < what.submatched.size(); ++i) {
>>
>> so, if I have, say, 10 subexpressions, and only two matched, instead
>> of checking every what[i] (for i = 0..9), I could access directly to
>> those two subexpressions. It'd be much more efficient.
>
>
> Hmm, it depends on what you want to do I guess: how would tell what
> index those two sub-expressions were, or don't you care? It also means
> a complete rewrite of the match_results interface, and probably the code
> that finds matches as well - it all assumes that match_results is
> basically an array of N sub-expressions.
well, since what[] is already an array of n subexpressions, during
finding of matches, I suppose, you set all the fields of what[i], if the
i-th subexpression matched. While you're doing this, you could also
store the index i into another structure of what.
I hope I explained this correctly...
Lorenzo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk