From c78d15eefd58b23026f70e4e6f8eb7fba4302b17 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Sun, 21 Sep 2014 11:12:02 +0200 Subject: [PATCH] return const refs from container-like labels --- alib2data/src/label/LabelPairLabel.cpp | 2 +- alib2data/src/label/LabelPairLabel.h | 2 +- alib2data/src/label/LabelSetLabel.cpp | 2 +- alib2data/src/label/LabelSetLabel.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alib2data/src/label/LabelPairLabel.cpp b/alib2data/src/label/LabelPairLabel.cpp index 1685ae410a..965950b589 100644 --- a/alib2data/src/label/LabelPairLabel.cpp +++ b/alib2data/src/label/LabelPairLabel.cpp @@ -23,7 +23,7 @@ LabelBase* LabelPairLabel::plunder() && { return new LabelPairLabel(std::move(*this)); } -std::pair<Label, Label> LabelPairLabel::getData() const { +const std::pair<Label, Label>& LabelPairLabel::getData() const { return label; } diff --git a/alib2data/src/label/LabelPairLabel.h b/alib2data/src/label/LabelPairLabel.h index b1032020cd..3eab974e02 100644 --- a/alib2data/src/label/LabelPairLabel.h +++ b/alib2data/src/label/LabelPairLabel.h @@ -43,7 +43,7 @@ public: /** * @return name of the symbol */ - std::pair<Label, Label> getData() const; + const std::pair<Label, Label>& getData() const; virtual bool operator <(const LabelPairLabel& other) const; virtual bool operator ==(const LabelPairLabel& other) const; diff --git a/alib2data/src/label/LabelSetLabel.cpp b/alib2data/src/label/LabelSetLabel.cpp index 7f87d67f3d..3ee80e4b49 100644 --- a/alib2data/src/label/LabelSetLabel.cpp +++ b/alib2data/src/label/LabelSetLabel.cpp @@ -23,7 +23,7 @@ LabelBase* LabelSetLabel::plunder() && { return new LabelSetLabel(std::move(*this)); } -std::set<Label> LabelSetLabel::getData() const { +const std::set<Label>& LabelSetLabel::getData() const { return label; } diff --git a/alib2data/src/label/LabelSetLabel.h b/alib2data/src/label/LabelSetLabel.h index 783fd226c4..51281a7a14 100644 --- a/alib2data/src/label/LabelSetLabel.h +++ b/alib2data/src/label/LabelSetLabel.h @@ -43,7 +43,7 @@ public: /** * @return name of the symbol */ - std::set<Label> getData() const; + const std::set<Label>& getData() const; virtual bool operator <(const LabelSetLabel& other) const; virtual bool operator ==(const LabelSetLabel& other) const; -- GitLab