27 size_t size()
const {
return states_.size(); }
40 template<
typename... Args>
41 requires std::constructible_from<
ModelState, Args&&...>
44 return *states_.emplace_back(std::make_shared<ModelState>(std::forward<Args>(args)...));
57 auto view()
const {
return states_ | std::views::transform([](
const auto& handle) ->
const_reference {
return *handle; }); }
59 auto begin()
const {
return view().begin(); }
60 auto end()
const {
return view().end(); }
63 std::vector<shared_handle> states_;
Definition model_state.h:19
Represents a sequence of ModelStates stored in shared handles.
Definition model_states.h:15
shared_handle handle_at(size_t pos)
Returns a shared handle to the element at specified location pos, with bounds checking.
Definition model_states.h:51
ModelStates()=default
Constructs an empty sequence of states.
void reserve(size_type new_cap)
Increases the capacity of the container to a value that's greater or equal to new_cap.
Definition model_states.h:36
auto end() const
Definition model_states.h:60
auto begin() const
Definition model_states.h:59
size_t size() const
Returns the number of elements in the container.
Definition model_states.h:27
size_t size_type
Definition model_states.h:18
void handle_push_back(shared_handle handle)
Appends a shared handle of ModelState to the end of the sequence.
Definition model_states.h:48
reference at(size_t pos)
Returns a reference to the element at specified location pos, with bounds checking.
Definition model_states.h:30
const_reference at(size_t pos) const
Returns a reference to the element at specified location pos, with bounds checking.
Definition model_states.h:33
std::shared_ptr< value_type > shared_handle
Definition model_states.h:21
std::vector< shared_handle > to_handle_list() const
Converts this ModelStates into a std::vector its shared_handles.
Definition model_states.h:54
const value_type & const_reference
Definition model_states.h:20
reference emplace_back(Args &&... args)
Definition model_states.h:42
Definition component_registry.h:14