Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-11-09 04:45:18


Hi Thorsten,

>
> First let me say that I think the library is ready for a review. (I think we

Thanks.

>
> 1.
>
> I prefer a more explicit version of
> a.. r.begin(new_begin) - resets the range's begin
> a.. r.end(new_end) - resets the range's end
> ie, I would like to see set_begin(...).

yup, will do.

I will certainly update the docs as soon as I have some more time.

>
> // STL version
> std::transform( v1.begin(), v1.end(), v2.begin(), std::back_inserter(v3),
> std::max<int>);
>
> // rng:: version
> rng::transform( v1, v2, std::back_inserter(v3), std::max<int>);
> --------------------
>
> initially an iterator would be enough in place of v2. So in some sense I think
> you should mention that you have make the requirement a bit
> stricter.
>

probaly. Also, I mentioned the i_ parameter.

> 3.
> The docs for The i_ or i_param shortcut could be better.

yup
>
> 4. "The coll_find is a shortcut for finding an element in a collection
> (non-associative array). ". The example then shows a map. Isn't a map an
> associative container?
>

oh crap ;) That was my mistake in the docs. Will fix it. Thanks.

> 5. some more docs on range adapters should be added. As a minimum requirement
> we need the synopsis of transformed() etc so we can see what it returns and
> takes.
> I some sense you have a very good toturial...now we need the reference
> docs.

yes, definitely. Again, will do it as soon as I have the time..

>
> 6. from some of the sorce files, you seems to be using r.begin() instead of
> begin(r).

I need to thoroughly think about this.
>
> 7. "to_end: return the [found, container.end()) range (this is the default"
>
> how do you implement defaults on function templates???

he he ;) Take a look at the implementation ;)
(in this case, I did it with a typedef enum)

>
> 8. have you thought about flags for error-strategies:
>
> find<or_throw>( v, 5 );
> find( v, 5 );
> find<to_end,or_throw>( v, 5 );
>

First of all, I think adding more than one template flags might be very
hard to implement.

Now, on the other side, if others are ok with this, I could certainly
implement it. I donot see much value in the 'or_throw' strategy, since
the same could be accomplished like this:

if ( !find(v,5) ) throw "whatever";

What do others think? What other strategies are there?

Best,
John

-- 
John Torjo,    Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
-- v1.5 - tooltips at your fingertips (work for menus too!)
    + bitmap buttons (work for MessageBox too!)
    + tab dialogs, hyper links, lite html

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