Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2000-09-19 05:48:24


>The benefit of an allocator (improved speed and/or memory control) applies

>only when memory allocation is a significant factor in the class's
>performance, and the class is performance critical in terms of
>applications.

That is in fact the case - allocation here is critical, but it's also
rather non-typical, and is dependent upon the regex internals (stuff the
user should not know about).

>Also consider that if the interface starts out with an allocator, it is
>very hard to remove it. But if it starts out with no allocator, it
doesn't
>break existing code to add one later.

That's why I brought this up now, I want to get all interfacte changes done
in one go, then I can go and concentrate on the back end. BTW the change
is only possible now because you asked for reg_match to be renamed, without
that I would have been stuck with it for compatabitity reasons.

This leads on to another design question:

Currently I have:

template <class iterator, class Allocator, class charT, class traits, class
Allocator2>
bool regex_match(iterator first,
                 iterator last,
                 match_results<iterator, Allocator>& m,
                 const reg_expression<charT, traits, Allocator2>& e,
                 unsigned flags = match_default);

But with a simplified match_results this can be changed to:

template <class iterator, class Allocator, class charT, class traits, class
Allocator2>
match_results<iterator> regex_match(iterator first,
                 iterator last,
                 const reg_expression<charT, traits, Allocator2>& e,
                 unsigned flags = match_default);

Which IMO makes for more readable code/easier usage. Again this kind of
change can only be made now while the interface is changing anyway (and I
should have brought it up before - apologies).

- John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk