From 22f6c1d7887d90cffbfaa521f2b9861c6117f630 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 3 Sep 2024 15:50:34 +0200 Subject: [PATCH] avoid dangling ref --- src/cpp/benders/outer_loop/OuterLoopInputDataReader.cpp | 2 +- src/cpp/benders/outer_loop/include/OuterLoopInputDataReader.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cpp/benders/outer_loop/OuterLoopInputDataReader.cpp b/src/cpp/benders/outer_loop/OuterLoopInputDataReader.cpp index 889301284..94a01074a 100644 --- a/src/cpp/benders/outer_loop/OuterLoopInputDataReader.cpp +++ b/src/cpp/benders/outer_loop/OuterLoopInputDataReader.cpp @@ -53,7 +53,7 @@ void OuterLoopInputData::AddSingleData(const OuterLoopSingleInputData &data) { outer_loop_data_.push_back(data); } -std::vector OuterLoopInputData::OuterLoopData() +const std::vector &OuterLoopInputData::OuterLoopData() const { return outer_loop_data_; } diff --git a/src/cpp/benders/outer_loop/include/OuterLoopInputDataReader.h b/src/cpp/benders/outer_loop/include/OuterLoopInputDataReader.h index 0c40875d7..ef31a46b6 100644 --- a/src/cpp/benders/outer_loop/include/OuterLoopInputDataReader.h +++ b/src/cpp/benders/outer_loop/include/OuterLoopInputDataReader.h @@ -80,7 +80,8 @@ class OuterLoopInputData { public: OuterLoopInputData() = default; - [[nodiscard]] std::vector OuterLoopData() const; + [[nodiscard]] const std::vector &OuterLoopData() + const; [[nodiscard]] std::vector PatternBodies() const; [[nodiscard]] std::string PatternsPrefix() const;