Skip to content

Commit 900a1a9

Browse files
committed
Add some basic intro text to the iter namespace for now
1 parent 08b818e commit 900a1a9

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

sus/collections/collections.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ namespace sus {
246246
/// # Ranges
247247
/// The collections in the Subspace C++ library can be used with standard ranges
248248
/// by calling the [`range()`]($sus::iter::IteratorBase::range) adaptor on any
249-
/// Subspace iterator. It will return an object that satisfies
249+
/// [`Iterator`]($sus::iter::Iterator). It will return an object that satisfies
250250
/// [`std::ranges::input_range`](https://en.cppreference.com/w/cpp/ranges/input_range)
251251
/// and
252252
/// [`std::ranges::viewable_range`](https://en.cppreference.com/w/cpp/ranges/viewable_range),
@@ -257,8 +257,9 @@ namespace sus {
257257
/// [`std::ranges::output_range`](https://en.cppreference.com/w/cpp/ranges/input_range),
258258
/// such as with `vec.iter_mut().range()`.
259259
///
260-
/// Conversely, standard ranges, such as the types in the standard containers
261-
/// library, can be used to construct a Subspace iterator through
260+
/// Conversely, an [`Iterator`]($sus::iter::Iterator) can be constructed for
261+
/// a standard range such as [`std::vector`](
262+
/// https://en.cppreference.com/w/cpp/container/vector) through
262263
/// [`sus::iter::from_range`]($sus::iter::from_range).
263264
///
264265
/// # Familiarity with Rust APIs

sus/iter/iterator.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,32 @@
1414

1515
#pragma once
1616

17+
namespace sus {
18+
19+
/// Composable external iteration.
20+
///
21+
/// If you've found yourself with a collection of some kind, and needed to
22+
/// perform an operation on the elements of said collection, you'll quickly run
23+
/// into 'iterators'. Iterators are heavily used in idiomatic Rust code, so
24+
/// it's worth becoming familiar with them.
25+
///
26+
/// The use of iterators with collections is described in [the collections
27+
/// documentation]($sus::collections#iterators).
28+
///
29+
/// TODO: Write lots more here.
30+
///
31+
/// All iterators implement the [`Iterator`]($sus::iter::Iterator) concept. Part
32+
/// of implementing that requires inheriting from [`IteratorBase`](
33+
/// $sus::iter::IteratorBase) which provides a large number of methods for
34+
/// filtering or transforming the items produced by the iterator. All of these
35+
/// methods are "lazy" in that they construct a new iterator but do not touch
36+
/// the source which generates items until iteration begins.
37+
///
38+
/// Iterators can [interact with standard ranges]($sus::collections#ranges) as
39+
/// well.
40+
namespace iter {}
41+
}
42+
1743
// IWYU pragma: begin_exports
1844
#include "sus/iter/iterator_defn.h"
1945
#include "sus/iter/iterator_impl.h"

0 commit comments

Comments
 (0)