1919
2020namespace nw {
2121namespace graph {
22- // / The cyclic neighbor range adapter.
23- // /
24- // / This adapter takes an underlying random access range and provides the
25- // / ability to split the range into cycles for TBB. A cycle is a subset of the
26- // / range such that each subsequent element is some stride from the previous
27- // / element.
28- // /
29- // / The cyclic range adapter is implemented recursively, that is that each time
30- // / the range is split it simply returns two ranges that cover the previous
31- // / range, each with twice the cycle and one offset by one element.
32- // /
33- // / Key to the adapter is the _cutoff_, which is defined in terms of the maximum
34- // / stride rather than in terms of the number of elements. A _cutoff_ of `1`
35- // / implies that the range can't be split, while a `_cutoff_` of `n` means that
36- // / the range can be split into up to `n` cycles.
37- // /
38- // / @tparam Iterator The type of the underlying range iterator (must be at
39- // / least random access).
22+ /* *
23+ * The cyclic neighbor range adapter.
24+ *
25+ * This adapter takes an underlying random access range and provides the
26+ * ability to split the range into cycles for TBB. A cycle is a subset of the
27+ * range such that each subsequent element is some stride from the previous
28+ * element.
29+ *
30+ * The cyclic range adapter is implemented recursively, that is that each time
31+ * the range is split it simply returns two ranges that cover the previous
32+ * range, each with twice the cycle and one offset by one element.
33+ *
34+ * Key to the adapter is the _cutoff_, which is defined in terms of the maximum
35+ * stride rather than in terms of the number of elements. A _cutoff_ of `1`
36+ * implies that the range can't be split, while a `_cutoff_` of `n` means that
37+ * the range can be split into up to `n` cycles.
38+ *
39+ * @tparam Iterator The type of the underlying range iterator (must be at
40+ * least random access).
41+ */
4042template <class Iterator >
4143class cyclic_neighbor_range {
4244 static_assert (std::is_base_of_v<std::random_access_iterator_tag, typename std::iterator_traits<Iterator>::iterator_category>);
@@ -83,17 +85,19 @@ class cyclic_neighbor_range {
8385 }
8486 };
8587
86- // / Return an iterator that points to the start of the cycle.
88+ /* * Return an iterator that points to the start of the cycle. */
8789 iterator begin () const {
8890 return { begin_, begin_ + cycle_, stride_ };
8991 }
9092
91- // / Return an iterator that points to the end of the cycle.
92- // /
93- // / The end of the cycle is the first iterator in the cycle that is greater
94- // / than or equal to the end_ iterator in the underlying range. End iterators
95- // / for different cycles will be different even if the underlying range and
96- // / strides match, so tests should not be performed across cycles.
93+ /* *
94+ * Return an iterator that points to the end of the cycle.
95+ *
96+ * The end of the cycle is the first iterator in the cycle that is greater
97+ * than or equal to the end_ iterator in the underlying range. End iterators
98+ * for different cycles will be different even if the underlying range and
99+ * strides match, so tests should not be performed across cycles.
100+ */
97101 iterator end () const {
98102 difference_type n = end_ - begin_ - cycle_; // shifted span for cycle
99103 difference_type r = n % stride_; // remainder in last stride
@@ -112,10 +116,12 @@ class cyclic_neighbor_range {
112116 return size () == 0 ;
113117 }
114118
115- // / Runtime check to see if the range is divisible.
116- // /
117- // / The range can be subdivided if its stride can be increased relative to the
118- // / cutoff.
119+ /* *
120+ * Runtime check to see if the range is divisible.
121+ *
122+ * The range can be subdivided if its stride can be increased relative to the
123+ * cutoff.
124+ */
119125 bool is_divisible () const {
120126 return stride_ <= cutoff_;
121127 }
0 commit comments