Skip to content

Commit e4e531c

Browse files
DenizThatMenaceDeniz Bahadir
authored andcommitted
Fix -Wdeprecated-this-capture warnings
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.)
1 parent 7d58126 commit e4e531c

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/draco/io/ply_property_reader.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,42 +31,42 @@ class PlyPropertyReader {
3131
// Find the suitable function for converting values.
3232
switch (property->data_type()) {
3333
case DT_UINT8:
34-
convert_value_func_ = [=](int val_id) {
34+
convert_value_func_ = [this](int val_id) {
3535
return this->ConvertValue<uint8_t>(val_id);
3636
};
3737
break;
3838
case DT_INT8:
39-
convert_value_func_ = [=](int val_id) {
39+
convert_value_func_ = [this](int val_id) {
4040
return this->ConvertValue<int8_t>(val_id);
4141
};
4242
break;
4343
case DT_UINT16:
44-
convert_value_func_ = [=](int val_id) {
44+
convert_value_func_ = [this](int val_id) {
4545
return this->ConvertValue<uint16_t>(val_id);
4646
};
4747
break;
4848
case DT_INT16:
49-
convert_value_func_ = [=](int val_id) {
49+
convert_value_func_ = [this](int val_id) {
5050
return this->ConvertValue<int16_t>(val_id);
5151
};
5252
break;
5353
case DT_UINT32:
54-
convert_value_func_ = [=](int val_id) {
54+
convert_value_func_ = [this](int val_id) {
5555
return this->ConvertValue<uint32_t>(val_id);
5656
};
5757
break;
5858
case DT_INT32:
59-
convert_value_func_ = [=](int val_id) {
59+
convert_value_func_ = [this](int val_id) {
6060
return this->ConvertValue<int32_t>(val_id);
6161
};
6262
break;
6363
case DT_FLOAT32:
64-
convert_value_func_ = [=](int val_id) {
64+
convert_value_func_ = [this](int val_id) {
6565
return this->ConvertValue<float>(val_id);
6666
};
6767
break;
6868
case DT_FLOAT64:
69-
convert_value_func_ = [=](int val_id) {
69+
convert_value_func_ = [this](int val_id) {
7070
return this->ConvertValue<double>(val_id);
7171
};
7272
break;

src/draco/io/ply_property_writer.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,42 +30,42 @@ class PlyPropertyWriter {
3030
// Find the suitable function for converting values.
3131
switch (property->data_type()) {
3232
case DT_UINT8:
33-
convert_value_func_ = [=](WriteTypeT val) {
33+
convert_value_func_ = [this](WriteTypeT val) {
3434
return this->ConvertValue<uint8_t>(val);
3535
};
3636
break;
3737
case DT_INT8:
38-
convert_value_func_ = [=](WriteTypeT val) {
38+
convert_value_func_ = [this](WriteTypeT val) {
3939
return this->ConvertValue<int8_t>(val);
4040
};
4141
break;
4242
case DT_UINT16:
43-
convert_value_func_ = [=](WriteTypeT val) {
43+
convert_value_func_ = [this](WriteTypeT val) {
4444
return this->ConvertValue<uint16_t>(val);
4545
};
4646
break;
4747
case DT_INT16:
48-
convert_value_func_ = [=](WriteTypeT val) {
48+
convert_value_func_ = [this](WriteTypeT val) {
4949
return this->ConvertValue<int16_t>(val);
5050
};
5151
break;
5252
case DT_UINT32:
53-
convert_value_func_ = [=](WriteTypeT val) {
53+
convert_value_func_ = [this](WriteTypeT val) {
5454
return this->ConvertValue<uint32_t>(val);
5555
};
5656
break;
5757
case DT_INT32:
58-
convert_value_func_ = [=](WriteTypeT val) {
58+
convert_value_func_ = [this](WriteTypeT val) {
5959
return this->ConvertValue<int32_t>(val);
6060
};
6161
break;
6262
case DT_FLOAT32:
63-
convert_value_func_ = [=](WriteTypeT val) {
63+
convert_value_func_ = [this](WriteTypeT val) {
6464
return this->ConvertValue<float>(val);
6565
};
6666
break;
6767
case DT_FLOAT64:
68-
convert_value_func_ = [=](WriteTypeT val) {
68+
convert_value_func_ = [this](WriteTypeT val) {
6969
return this->ConvertValue<double>(val);
7070
};
7171
break;

0 commit comments

Comments
 (0)