From 077c1cba9fcac396f729e1334c8a7b5d12396b42 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Fri, 21 Jun 2019 08:31:59 +0200
Subject: [PATCH] tiny improvement

---
 .../abstraction/ValueOperationAbstraction.hpp    | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/alib2abstraction/src/abstraction/ValueOperationAbstraction.hpp b/alib2abstraction/src/abstraction/ValueOperationAbstraction.hpp
index ef0522b42a..8e5b822979 100644
--- a/alib2abstraction/src/abstraction/ValueOperationAbstraction.hpp
+++ b/alib2abstraction/src/abstraction/ValueOperationAbstraction.hpp
@@ -21,7 +21,7 @@ class ValueOperationAbstractionImpl : virtual public ValueInterface < ReturnType
 	mutable std::optional < ReturnType > m_data;
 
 protected:
-	void setData ( ReturnType data ) {
+	void setData ( ReturnType && data ) {
 		m_data = std::move ( data );
 	}
 
@@ -46,7 +46,7 @@ class ValueOperationAbstractionImpl < const ReturnType > : virtual public ValueI
 	mutable std::optional < ReturnType > m_data;
 
 protected:
-	void setData ( ReturnType data ) {
+	void setData ( ReturnType && data ) {
 		m_data = std::move ( data );
 	}
 
@@ -93,15 +93,15 @@ public:
 
 template < class ReturnType >
 class ValueOperationAbstractionImpl < const ReturnType & > : virtual public ValueInterface < ReturnType > {
-	mutable std::optional < std::reference_wrapper < const ReturnType > > m_data;
+	mutable std::optional < std::reference_wrapper < ReturnType > > m_data;
 
 protected:
 	void setData ( const ReturnType & data ) {
-		m_data = std::reference_wrapper < const ReturnType > ( data );
+		m_data = std::reference_wrapper < ReturnType > ( const_cast < ReturnType & > ( data ) );
 	}
 
 	ReturnType && getValue ( ) const override {
-		return std::move ( const_cast < ReturnType & > ( m_data->get ( ) ) );
+		return std::move ( m_data->get ( ) );
 	}
 
 public:
@@ -143,15 +143,15 @@ public:
 
 template < class ReturnType >
 class ValueOperationAbstractionImpl < const ReturnType && > : virtual public ValueInterface < ReturnType > {
-	mutable std::optional < std::reference_wrapper < const ReturnType > > m_data;
+	mutable std::optional < std::reference_wrapper < ReturnType > > m_data;
 
 protected:
 	void setData ( const ReturnType && data ) {
-		m_data = std::reference_wrapper < const ReturnType > ( data );
+		m_data = std::reference_wrapper < ReturnType > ( const_cast < ReturnType & > ( data ) );
 	}
 
 	ReturnType && getValue ( ) const override {
-		return std::move ( const_cast < ReturnType & > ( m_data->get ( ) ) );
+		return std::move ( m_data->get ( ) );
 	}
 
 public:
-- 
GitLab