[...]
Probably because that's not its role. But it's an interesting
suggestion---it should be possible to define a manipulator which
skips using a predicate.
template < typename Pred >
istream& ignore( istream& s, Pred pred )
{
char c = 0;
while ( s.get( c ) && pred( c ) )
{ }
}
Which will extract one character too many. And you need either
something like:
template< typename Pred > std::istream& ignore( istream& s ) ;
for the interface, or the function should return some special
type, e.g.:
template< typename Pred >
Ignorer< Pred >
ignore( Pred p )
{
return Ignorer< Pred >( p ) ;
}
with the actual work being done in the >> operator of Ignorer<
Pred >.
Using a state-full predicate in the above would probably work
for that.
Not for the extended regular expressions of Boost. Those
require backtracking, and there's practically no way to
implement backtracking.
--
James Kanze (GABI Software) email:
[email protected]
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34