Skip to content

Commit 8cbf7ae

Browse files
committed
Fix outdated sliceBy usage
1 parent 0c85409 commit 8cbf7ae

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

docs/tutorials/indexTables.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,17 @@ struct ConsumeColExtra {
6565

6666
### PartitionColExtra
6767

68-
Index columns allow to easily select e.g. all tracks belonging to a given collision using the sliceBy() method (see also [DECLARE_SOA_TABLE](creatingTables.md#declareTables)). groupedTracks contains only tracks which belong to Collision col.
69-
68+
Index columns allow to easily select e.g. all tracks belonging to a given collision using the `sliceBy()` method (see also [DECLARE_SOA_TABLE](creatingTables.md#declareTables)). groupedTracks contains only tracks which belong to Collision col.
69+
The slicing needs to be pre-declared using `Preslice` (or `PresliceUnsorted` if the index is not sorted) so that the framework can prepare and add it to the internal cache.
7070
```cpp
71-
auto groupedTracks = tracks.sliceBy(aod::track::collisionId, col.globalIndex());
71+
struct Task {
72+
Preslice<aod::Tracks> perCol = aod::track::collisionId;
73+
void proces(aod::Collisions const & cols, aod::Tracks const& tracks) {
74+
for (auto& col : cols) {
75+
auto groupedTracks = tracks.sliceBy(perCol, col.globalIndex());
76+
}
77+
}
78+
}
7279
```
7380
7481
<a name="hmpidtask"></a>

0 commit comments

Comments
 (0)