Skip to content

Commit

Permalink
Fix -Wdeprecated-this-capture warnings
Browse files Browse the repository at this point in the history
C++20 deprecated implicit capturing of `this` in lambdas when capturing
with `[=]`. Therefore these implicit captures are replaced by explicit
ones. (This is backwards-compatible with earlier C++ standards that
support lambdas.)
  • Loading branch information
DenizThatMenace committed Oct 17, 2023
1 parent 91ab336 commit 5104ce2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/draco/io/ply_property_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,42 @@ class PlyPropertyReader {
// Find the suitable function for converting values.
switch (property->data_type()) {
case DT_UINT8:
convert_value_func_ = [=](int val_id) {
convert_value_func_ = [this](int val_id) {
return this->ConvertValue<uint8_t>(val_id);
};
break;
case DT_INT8:
convert_value_func_ = [=](int val_id) {
convert_value_func_ = [this](int val_id) {
return this->ConvertValue<int8_t>(val_id);
};
break;
case DT_UINT16:
convert_value_func_ = [=](int val_id) {
convert_value_func_ = [this](int val_id) {
return this->ConvertValue<uint16_t>(val_id);
};
break;
case DT_INT16:
convert_value_func_ = [=](int val_id) {
convert_value_func_ = [this](int val_id) {
return this->ConvertValue<int16_t>(val_id);
};
break;
case DT_UINT32:
convert_value_func_ = [=](int val_id) {
convert_value_func_ = [this](int val_id) {
return this->ConvertValue<uint32_t>(val_id);
};
break;
case DT_INT32:
convert_value_func_ = [=](int val_id) {
convert_value_func_ = [this](int val_id) {
return this->ConvertValue<int32_t>(val_id);
};
break;
case DT_FLOAT32:
convert_value_func_ = [=](int val_id) {
convert_value_func_ = [this](int val_id) {
return this->ConvertValue<float>(val_id);
};
break;
case DT_FLOAT64:
convert_value_func_ = [=](int val_id) {
convert_value_func_ = [this](int val_id) {
return this->ConvertValue<double>(val_id);
};
break;
Expand Down
16 changes: 8 additions & 8 deletions src/draco/io/ply_property_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,42 @@ class PlyPropertyWriter {
// Find the suitable function for converting values.
switch (property->data_type()) {
case DT_UINT8:
convert_value_func_ = [=](WriteTypeT val) {
convert_value_func_ = [this](WriteTypeT val) {
return this->ConvertValue<uint8_t>(val);
};
break;
case DT_INT8:
convert_value_func_ = [=](WriteTypeT val) {
convert_value_func_ = [this](WriteTypeT val) {
return this->ConvertValue<int8_t>(val);
};
break;
case DT_UINT16:
convert_value_func_ = [=](WriteTypeT val) {
convert_value_func_ = [this](WriteTypeT val) {
return this->ConvertValue<uint16_t>(val);
};
break;
case DT_INT16:
convert_value_func_ = [=](WriteTypeT val) {
convert_value_func_ = [this](WriteTypeT val) {
return this->ConvertValue<int16_t>(val);
};
break;
case DT_UINT32:
convert_value_func_ = [=](WriteTypeT val) {
convert_value_func_ = [this](WriteTypeT val) {
return this->ConvertValue<uint32_t>(val);
};
break;
case DT_INT32:
convert_value_func_ = [=](WriteTypeT val) {
convert_value_func_ = [this](WriteTypeT val) {
return this->ConvertValue<int32_t>(val);
};
break;
case DT_FLOAT32:
convert_value_func_ = [=](WriteTypeT val) {
convert_value_func_ = [this](WriteTypeT val) {
return this->ConvertValue<float>(val);
};
break;
case DT_FLOAT64:
convert_value_func_ = [=](WriteTypeT val) {
convert_value_func_ = [this](WriteTypeT val) {
return this->ConvertValue<double>(val);
};
break;
Expand Down

0 comments on commit 5104ce2

Please sign in to comment.