From c20bdd68796c0fc31441ffe059a462a0d423cc77 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 12 Nov 2014 07:52:07 +0100 Subject: Add utils::revstr --- src/utils/revstr.cpp | 9 +++++++++ src/utils/revstr.hpp | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/utils/revstr.cpp create mode 100644 src/utils/revstr.hpp (limited to 'src/utils') diff --git a/src/utils/revstr.cpp b/src/utils/revstr.cpp new file mode 100644 index 0000000..87fd801 --- /dev/null +++ b/src/utils/revstr.cpp @@ -0,0 +1,9 @@ +#include + +namespace utils +{ + std::string revstr(const std::string& original) + { + return {original.rbegin(), original.rend()}; + } +} diff --git a/src/utils/revstr.hpp b/src/utils/revstr.hpp new file mode 100644 index 0000000..0f00076 --- /dev/null +++ b/src/utils/revstr.hpp @@ -0,0 +1,11 @@ +#ifndef REVSTRP_INCLUDED +# define REVSTR_INCLUDED + +#include + +namespace utils +{ + std::string revstr(const std::string& original); +} + +#endif // REVSTR_INCLUDED -- cgit v1.2.3