Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-02-05 09:32:23


"Neal D. Becker" <nbecker_at_[hidden]> writes:

> Here is a cleaner and better version of my 2 examples.

I didn't take too long to look at them, but some of the lines in
zippy_iterator are really long. I think you could improve
readability a lot by wrapping and indenting.

> I also have a couple of questions, maybe someone can help me to improve
> these:
>
> Question 1:
> As a convenience in TestZip.cc, I made the function:
> template<typename T>
> inline array<T,2> make_array_2 (T t1, T t2);
>
> Is there a resonable way to make a function make_array_N?

I guess I don't understand what you mean by "reasonable". Is there
something wrong with what you did?

> Question 2:
>
> In zippy_iterator.H I needed to add const_casts or else I got errors on
> std::distance. Is there a better approach?

Well, const_cast doesn't really work there as you'll see if you use,
e.g., deques of iterators instead of boost::array's of iterators.

But I can't see why distance would cause you any trouble without the
const_casts in the first place. What errors were you seeing?

BTW, thanks for working on these examples. More examples are sure to
help our users!

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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