Skip to content

Commit fa93eb9

Browse files
committed
doc: view::operator| for storage types
1 parent 47d0a43 commit fa93eb9

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

TODO

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,3 @@ TODO:
4343
* any cdynamic to support const ownership construction
4444
* track meta context on meta elements
4545
* safer meta_data/meta_func (no blind indirections)
46-
* write doc for view::join and decide whether I like it or prefer operator| for consistency :)

docs/md/entity.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,23 +1833,26 @@ the `my_type` component, regardless of what other components they have.
18331833

18341834
### View pack
18351835

1836-
Views are combined with each other to create new and more specific queries.<br/>
1837-
The type returned when combining multiple views together is itself a view, more
1838-
in general a multi component one.
1836+
Views are combined with storage objects and with each other to create new, more
1837+
specific _queries_.<br/>
1838+
The type returned when combining multiple elements together is itself a view,
1839+
more in general a multi component one.
18391840

1840-
Combining different views tries to mimic C++20 ranges:
1841+
Combining different elements tries to mimic C++20 ranges:
18411842

18421843
```cpp
18431844
auto view = registry.view<position>();
18441845
auto other = registry.view<velocity>();
1846+
const auto &storage = registry.storage<renderable>();
18451847

1846-
auto pack = view | other;
1848+
auto pack = view | other | renderable;
18471849
```
18481850

18491851
The constness of the types is preserved and their order depends on the order in
1850-
which the views are combined. For example, the pack above returns an instance of
1851-
`position` first and then one of `velocity`.<br/>
1852-
Since combining views generates views, a chain can be of arbitrary length and
1852+
which the views are combined. For example, the above _pack_ first returns an
1853+
instance of `position`, then one of `velocity`, and finally one of
1854+
`renderable`.<br/>
1855+
Since combining elements generates views, a chain can be of arbitrary length and
18531856
the above type order rules apply sequentially.
18541857

18551858
### Iteration order

0 commit comments

Comments
 (0)