Skip to content

Commit b83c803

Browse files
authored
Fix PointData::setIndexOfVariant accidentally doing pass-by-value (#495)
The first parameter of the private member function `PointData::setIndexOfVariant` should be passed by reference. Before this commit, it did pass-by-value, causing calls to `PointData::setElementTypeSpecifier` to have no effect at all. The bug was introduced with pull request #454 commit 55f50a9 "Replace private `PointData::VectorHolder` class with `std::variant` (merged on 5 February 2024) and reported to me by Jeroen Eggermont.
1 parent 1a96b1c commit b83c803

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

HDPS/src/plugins/PointData/src/PointData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class POINTDATA_EXPORT PointData : public mv::plugin::RawData
7878
// Inspired by `expand_type` from kmbeutel at
7979
// https://www.reddit.com/r/cpp/comments/f8cbzs/creating_stdvariant_based_on_index_at_runtime/?rdt=52905
8080
template <typename... Alternatives>
81-
static void setIndexOfVariant(std::variant<Alternatives...> var, std::size_t index)
81+
static void setIndexOfVariant(std::variant<Alternatives...>& var, std::size_t index)
8282
{
8383
if (index != var.index())
8484
{

0 commit comments

Comments
 (0)