|
|
|
|
|
by msclrhd
2210 days ago
|
|
Ranges are a (start, end) pair of iterators that support begin/end -- think of them like a subset of containers that just provide access to the iterators over them. They also support the end iterator being a different type to the sstart iterator, supporting things like sentinel iterators (e.g. null pointer checks). The next standard library supports using the standard algorithms with ranges, so you can say things like `std::sort(v)` instead of `std::sort(v.begin(), v.end())`. IIUC, views are ranges that can adapt the results of the underlying object without changing the contents of that object, such as a lower-case view, or a reversed view. These work by doing the lower-case conversion on dereference, or swapping the increment/decrement operations. |
|