Skip to content

Commit bba235b

Browse files
committed
Fix compilation error implicitly capturing variables from a structured binding.
1 parent 41598a9 commit bba235b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

bindings/Python/regression_report.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void init_regression_report(py::module_ &m) {
5050
throw py::value_error{ fmt::format(R"(The type of the correct labels "{}" differs from the type of the predicted labels "{}"!)", dtype_correct_label.attr("name").cast<std::string>(), dtype_predicted_label.attr("name").cast<std::string>()) };
5151
}
5252

53-
return std::visit([&predicted_label_variant, force_finite](auto &&correct_label) {
53+
return std::visit([&predicted_label_variant = predicted_label_variant, force_finite](auto &&correct_label) {
5454
using vector_type = plssvm::detail::remove_cvref_t<decltype(correct_label)>;
5555
return plssvm::regression_report{ correct_label, std::get<vector_type>(predicted_label_variant), plssvm::regression_report::force_finite = force_finite };
5656
},

bindings/Python/sklearn_svc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ void init_sklearn_svc(py::module_ &m) {
613613
self.feature_names_ = opt_feature_names;
614614

615615
// create the data set to fit
616-
std::visit([&self, &data_matrix](auto &&labels_vector) {
616+
std::visit([&self, &data_matrix = data_matrix](auto &&labels_vector) {
617617
// get the label type and possible data set types
618618
using label_type = typename plssvm::detail::remove_cvref_t<decltype(labels_vector)>::value_type;
619619
using possible_data_set_types = typename svc::possible_data_set_types;
@@ -635,7 +635,7 @@ void init_sklearn_svc(py::module_ &m) {
635635
// convert the data py::object to a plssvm::aos_matrix
636636
const auto &[data_matrix, opt_feature_names] = plssvm::bindings::python::util::pyobject_to_matrix(data);
637637

638-
return std::visit([&self, &data_matrix](auto &&model) {
638+
return std::visit([&self, &data_matrix = data_matrix](auto &&model) {
639639
// get the label type
640640
using label_type = typename plssvm::detail::remove_cvref_t<decltype(model)>::label_type;
641641
// create the data set to predict
@@ -661,7 +661,7 @@ void init_sklearn_svc(py::module_ &m) {
661661
const auto &[data_matrix, opt_feature_names] = plssvm::bindings::python::util::pyobject_to_matrix(data);
662662

663663
// score the data
664-
return std::visit([&self, &data_matrix, &dtype](auto &&labels_vector) {
664+
return std::visit([&self, &data_matrix = data_matrix, &dtype = dtype](auto &&labels_vector) {
665665
// get the label types
666666
using label_type = typename plssvm::detail::remove_cvref_t<decltype(labels_vector)>::value_type;
667667
// create the data set to score

bindings/Python/sklearn_svr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ void init_sklearn_svr(py::module_ &m) {
343343
self.feature_names_ = opt_feature_names;
344344

345345
// create the data set to fit
346-
std::visit([&self, &data_matrix](auto &&labels_vector) {
346+
std::visit([&self, &data_matrix = data_matrix](auto &&labels_vector) {
347347
// get the label type and possible data set types
348348
using label_type = typename plssvm::detail::remove_cvref_t<decltype(labels_vector)>::value_type;
349349
using possible_data_set_types = typename svr::possible_data_set_types;
@@ -365,7 +365,7 @@ void init_sklearn_svr(py::module_ &m) {
365365
// convert the data py::object to a plssvm::aos_matrix
366366
const auto &[data_matrix, opt_feature_names] = plssvm::bindings::python::util::pyobject_to_matrix(data);
367367

368-
return std::visit([&self, &data_matrix](auto &&model) {
368+
return std::visit([&self, &data_matrix = data_matrix](auto &&model) {
369369
// get the label type
370370
using label_type = typename plssvm::detail::remove_cvref_t<decltype(model)>::label_type;
371371
// create the data set to predict
@@ -388,7 +388,7 @@ void init_sklearn_svr(py::module_ &m) {
388388
const auto &[data_matrix, opt_feature_names] = plssvm::bindings::python::util::pyobject_to_matrix(data);
389389

390390
// score the data
391-
return std::visit([&self, &data_matrix, &dtype](auto &&labels_vector) {
391+
return std::visit([&self, &data_matrix = data_matrix, &dtype = dtype](auto &&labels_vector) {
392392
// get the label types
393393
using label_type = typename plssvm::detail::remove_cvref_t<decltype(labels_vector)>::value_type;
394394
// create the data set to score

0 commit comments

Comments
 (0)