Re: [glas] using (boost)range or STL style interface [was: dense and sparse vectors]
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2005-08-03 20:17:09
On Wednesday 03 August 2005 5:39 pm, Toon Knapen wrote:
> David Abrahams wrote:
> > For what it's worth, the MTL4 project is using a Sequence interface:
> > (http://tinyurl.com/cdnlt or
> > http://boost-consulting.com/projects/mtl4/libs/sequence/doc/html/),
> > which is similar to the Boost.Range interface, but generalized along
> > several dimensions.
> > - Instead of iterators, we use cursors and property maps:
> > http://tinyurl.com/7hcka
> > (http://boost-consulting.com/projects/mtl4/libs/sequence/doc/html/cursors
> Very interesting indeed. How would you compare the cursors and property
> maps approach with the n1531 proposal? Do you have a prototype lying
> around that I can use to get some hands on experience?
> Note: The motivation for my response on the range-style interface was
> mainly that from my experience numerics people (which are the (future)
> users of glas) need 'everything as simple as possible but not simpler'
> (to quote Einstein). Everybody is now familiar with the [begin,end[
> iterators. Using an alternative style can therefore only be adopted IMHO
> if it clearly provides a lot of added value. [...]
I am probably not the best qualified to speak on the advantages of ranges over
iterators. My experience since boost::range was added has been very
positive, but I would have to do some research to say precisely why. One
advantage that does come to mind is that a range can be an object returned
from a function, allowing a function returning a range to be an input to
another function which takes a range as a parameter - something not so easy
to do with iterators.
Another help for newbies, is that a plain-old C array is a range, without
extra syntactic gyrations. That is,
That's easier than:
func_taking_iterators (&x, &x[sizeof(x)/sizeof(int)]);