From 7f25b8bae9908f5eb821ff5b6fc876041f68b92e Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Tue, 12 Aug 2014 18:19:25 +0200
Subject: [PATCH] fix operator < in strings

---
 alib2data/src/string/CyclicString.cpp | 2 +-
 alib2data/src/string/Epsilon.cpp      | 4 ++--
 alib2data/src/string/LinearString.cpp | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/alib2data/src/string/CyclicString.cpp b/alib2data/src/string/CyclicString.cpp
index c0a2a7c113..8442041b5f 100644
--- a/alib2data/src/string/CyclicString.cpp
+++ b/alib2data/src/string/CyclicString.cpp
@@ -101,7 +101,7 @@ bool CyclicString::operator<(const LinearString& other) const {
 }
 
 bool CyclicString::operator<(const CyclicString& other) const {
-	return m_Data < other.m_Data;
+	return std::tie(m_Data, alphabet) < std::tie(other.m_Data, other.alphabet);
 }
 
 bool CyclicString::operator<(const Epsilon& other) const {
diff --git a/alib2data/src/string/Epsilon.cpp b/alib2data/src/string/Epsilon.cpp
index 5c27657ada..40ddbed801 100644
--- a/alib2data/src/string/Epsilon.cpp
+++ b/alib2data/src/string/Epsilon.cpp
@@ -50,8 +50,8 @@ bool Epsilon::isEmpty() const {
 	return true;
 }
 
-bool Epsilon::operator<(const Epsilon&) const {
-	return false;
+bool Epsilon::operator<(const Epsilon& other) const {
+	return alphabet < other.alphabet;
 }
 
 bool Epsilon::operator<(const LinearString& other) const {
diff --git a/alib2data/src/string/LinearString.cpp b/alib2data/src/string/LinearString.cpp
index 3fa17d1cb0..2a4eb3ce44 100644
--- a/alib2data/src/string/LinearString.cpp
+++ b/alib2data/src/string/LinearString.cpp
@@ -101,7 +101,7 @@ bool LinearString::isEmpty() const {
 }
 
 bool LinearString::operator<(const LinearString& other) const {
-	return m_Data < other.m_Data;
+	return std::tie(m_Data, alphabet) < std::tie(other.m_Data, other.alphabet);
 }
 
 bool LinearString::operator<(const CyclicString& other) const {
-- 
GitLab