Differences between gsl::span and proposed ranges?

734 views
Skip to first unread message

Christopher Horvath

unread,
May 10, 2016, 3:52:09 PM5/10/16
to std-pr...@isocpp.org
Hey Folks,

I feel like the concepts implemented in the "span" classes in the Core Guidelines and the gsl library are a small subset of the functionality that will be introduced when the ranges/v3 proposal is finally added to the language.

Am I incorrect in thinking this? 

Chris

Nicol Bolas

unread,
May 10, 2016, 4:34:18 PM5/10/16
to ISO C++ Standard - Future Proposals

`span` is a concrete class (well, it's a template class but you know what I mean) which has specific functionality. "Ranges" are concepts; they represent patterns that other datatypes can implement.

A `span` is a range type, but not all ranges are `span`s. `vector`, `list`, and the other containers are also ranges.

The Ranges TS does not provide `span` or anything like `span` as a type. Indeed, if I recall correctly, the current Ranges TS doesn't provide any range types at all. Such types are reserved for the next version of the proposal.

I don't believe that Boost.Range provides anything quite like `span` either. While it does have iterator ranges, it doesn't have a range type that restricts itself to contiguous arrays only. `span` does.

So really, `span` has little to do with the Range TS, and it is not derived from it.

Christopher Horvath

unread,
May 10, 2016, 4:38:30 PM5/10/16
to std-pr...@isocpp.org
Thank you!

I really like the span stuff as implemented in the GSL - however, I'm worried that adoption and support of GSL seems very polarized.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/6f9ee0f4-3273-4910-8bac-84c18f8d9085%40isocpp.org.

Reply all
Reply to author
Forward
0 new messages