This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Search algorithms in __gnu_cxx::


Hi Dhruv,

something like:

/* Preprocess string str. */
bm_struct bm_preprocess(std::string const& str);

/* Ignoring templates for the time being, takes in the string
* to be searched for(short_str), the string to search in(long_str),
* and the start position in long_str(start_at). Returns the
* position at which the first match was found.
*/
size_t bm_search(bm_struct& long_str, bm_struct& short_str, size_t start_at);

I would rather prefer more iterators and a tad more consistency with std::search. More like:


template<typename _ForIter>
_ForIter
__*_search(const __bm_struct<typename iterator_traits<_ForIter>::value_type>& __b,
_ForIter __first, _ForIter __last)


In case, _RandomAccessIterator or what else, it depends on the algorithm, of course. What do you think?

Paolo.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]