|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-10-28 06:15:48
"Pavol Droba" <droba_at_[hidden]> wrote in message
news:20031028104441.GB5420_at_lenin.felcer.sk...
> On Tue, Oct 28, 2003 at 08:17:34PM +1100, Thorsten Ottosen wrote:
[snip]
> > AFAICT, unsigned types are for bit manipulation (and confusion), not
much
> > else.
> >
> > I'll like the library to be easy to use. If I use an int, I have to make
the
> > make the cast myself:
> >
> > find_nth( s, numeric_cast<unsigned>( i ) );
> >
> > I think the library should make that check for me.
>
> You should not use an "int" ...
>
> Index is a positived integer, so it is denoted by an "unsigned" number,
Not all think an index is unsigned? Take a look at NTL.
>what it
> wrong with this and why do you want to use int instead?
Basically I want to use int whereever posisble so I don't have to worry
about
signed to unsiged conversions. The fact that the standard library does
so/allows just makes
programming harder that it has to be.
> Why do you need to convert a result from f.e. find_first( str1, "abc" ) to
> > > a string?
> > > You don't need to use find(), to get this result, because it is
obiously
> > > "abc".
> > >
> > the example is made up. just image the its a regular expression.
>
> This example is not made up. Even for regular expression, the real
> reference to the original container is most important ...
yes it is; I made it up :-) My point was that you should replace find with
find_regex and "abc" with a regular expression of some kind.
> > > Purpose of find() is to look for a part of the sequence which has the
> > > required criterium,
> > > IOW to find pointers to the original sequence so, that some operation
> > > requiring this
> > > info can be executed ( like splitting, erasing or transformation ).
> > >
> > and this task could still be done wither either a substring or an
iterator
> > range or just std::pair.
> >
>
> It could not be done with a substring, because it depends on the
underlying container.
> This is a strong contraint, that iterator_range does not have.
> And yes, std::pair could be used, but iterator_range provide an
> interface which is more suitable for this purpose.
I meant the basic_substring I just implemented.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk