
Boost : 
From: Dirk Gregorius (dirk_at_[hidden])
Date: 20041016 08:53:37
Hi there,
> I'm not very good at explaining the things in short, but I'll try.
thanks for the explanation. I think I got it and it was not as bad as you
maybe think.
To come back to the initial problem of string tokenizing. I am trying to
implement the finder in terms
of ForwardIteratorT. Here is what I think I am expecting to do  also
actually I am not very sure about it.
I justed started to read M. Austern's book and I am quite new to concepts,
requirements and so on.
So here is what I did so far:
struct comment_finder
{
template<typename ForwardIteratorT>
boost::iterator_range<ForwardIteratorT> operator()( ForwardIteratorT Begin,
ForwardIteratorT End )
{
ForwardIteratorT first, last;
while ( Begin != End )
{
first = Begin;
if ( *Begin++ == '/' && *Begin == '/' )
{
last = first;
while ( *last++ != '\n' )
{
// FAILURE: Return an empty range
if ( last == End )
return boost::make_range( ??, ?? ); // return an empty range  HOW?
}
// SUCCESS: Return the range
return boost::make_range( first, last + 1 );
}
}
return boost::make_range( ??, ?? ); // return an empty range  HOW?
}
};
Is this the way I have to implement the finder or can it be implemented
using some facilities in your library?
This implementation is quite lowlevel, so I am wondering if this is
correct.
Secondly, for the case this is correct, how should I return an empty range
or what shall I return if didn't find a
matching range?
What are the following steps? Do I have to split two time times or how do I
erase the comments out of the string?
Will the final token iterator be only of ForwardIteratorT or will be of the
type of the conatiner that is
holding the tokens. ( e.g. for a vector it would be a randow access
iterator? )
Sorry for the inconvinience and thanks for the help so far.
Dirk
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk