Boost logo

Boost Users :

From: François Duranleau (duranlef_at_[hidden])
Date: 2005-12-05 16:16:28


On Sat, 3 Dec 2005, Victor A. Wagner Jr. wrote:

> After reading (and re-reading a few times) the documentation on
> range, it appears to me that there is little (if any) difference between:
> boost::sub_range<T>
> and
> boost::iterator_range<T::iterator>

Seems to me that sub_range is a convenience class to describe iterator
ranges from ranges or containers that model ForwardRange, from which you
can propagate constness.

> I've been working on a N way merge algorithm for work, and thought it
> might be a nice chance to learn bost::range and maybe even get it
> general enough to submit for boost utility some day.
> At any rate. Here's the problem: I've written a test case and two
> implementations (work still in progress) but I get compile errors
> when I try to use sub_range.
>
> the code can be found at http://www.noidea128.org/sourcefiles/15646~
>
> to change the program from compiling/running the iterator_range to
> sub_range simply change the lne from:
>
> Nway_merge(contain, ourmerged);
> -to-
> SNway_merge(contain, ourmerged);
>
> my compiler (VC-8_0) gives two errors which I cannot decipher.
> Any assistance would be appreciated.... especially if I've
> misunderstood why sub_range instead of iterator_range.

Mm, I don't know. The only thing g++-4.0 (sorry, I can't help you with VC)
was complaining about are the missing 'typename's for the declaration of
member_container_iterator and iterator_range_iterator in Nway_merge, and
sub_range_iterator in SNway_merge. What are the errors reported by the
compiler?

-- 
François Duranleau
LIGUM, Université de Montréal
"There once was a boy who dreamed of being a hero,
  who believed sincerely in the battle
  to banish Darkness from a world of Light.
  But Light and Darkness are equal,
  and where one exists, so too must the other.
  And when the boy finally realized this,
  he had taken the first step toward being a true hero."
                                                - from Record of Lodoss War

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net