From eb047ec633af60bcf944cc5816f2924b9e43bcfe Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Sat, 15 Aug 2020 20:38:39 +0200 Subject: [PATCH] gui: fix string related C++20 changes --- alib2gui/src/Algorithm/Algorithm.cpp | 3 ++- alib2gui/test-src/RegistryTest.cpp | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/alib2gui/src/Algorithm/Algorithm.cpp b/alib2gui/src/Algorithm/Algorithm.cpp index a6b1e1fdac..6c216a3a8d 100644 --- a/alib2gui/src/Algorithm/Algorithm.cpp +++ b/alib2gui/src/Algorithm/Algorithm.cpp @@ -60,7 +60,8 @@ bool Algorithm::canAddOverload(const Algorithm::Overload& overload) { } std::string Algorithm::getPrettyName() const { - std::string eps = u8"\u03B5"; + std::u8string str = u8"\u03B5"; + std::string eps ( str.begin ( ), str.end ( ) ); static std::map<std::string, std::string> prettyNames = { {"automaton::simplify::SingleInitialState", "Single Initial"}, {"automaton::simplify::EpsilonRemoverIncoming", eps + "-Remove In"}, diff --git a/alib2gui/test-src/RegistryTest.cpp b/alib2gui/test-src/RegistryTest.cpp index 3127eb763f..d322a98d5b 100644 --- a/alib2gui/test-src/RegistryTest.cpp +++ b/alib2gui/test-src/RegistryTest.cpp @@ -41,6 +41,9 @@ TEST_CASE ( "Registry", "[unit][gui][registry]" ) { auto* algo = Registry::getAlgorithm("automaton::transform::AutomataConcatenationEpsilonTransition"); REQUIRE(algo != nullptr); - CHECK(algo->getPrettyName() == u8"\u03B5-Concatenate"); + + std::u8string name = u8"\u03B5-Concatenate"; + std::string expected ( name.begin ( ), name.end ( ) ); + CHECK(algo->getPrettyName() == expected ); } } -- GitLab