Skip to content

Commit

Permalink
BUG: DataArray::getComponent should return a value not a reference (#…
Browse files Browse the repository at this point in the history
…1183)

* AbstractDataStore::getValue which is used to implement
DataArray::getComponent returns a value but before this commit
AbstractDataStore::getValue return a reference which lead to a
dangling reference to a temporary value

Signed-off-by: Jared Duffey <[email protected]>
  • Loading branch information
JDuffeyBQ authored Jan 21, 2025
1 parent 08c6f49 commit 6eac7f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/simplnx/DataStructure/DataArray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class DataArray : public IDataArray
return m_DataStore->getValue(index);
}

const_reference getComponent(usize tupleIndex, usize componentIndex)
value_type getComponent(usize tupleIndex, usize componentIndex)
{
const usize index = tupleIndex * getNumberOfComponents() + componentIndex;
return m_DataStore->getValue(index);
Expand Down

0 comments on commit 6eac7f1

Please sign in to comment.