Module: check_mk
Branch: master
Commit: 775abd15d9913a2a70aca04572428cd3bd89c166
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=775abd15d9913a…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Feb 14 11:36:37 2018 +0100
Make RegExp movable.
This is easy to do and opens up more STL usage. Note that RegExp is still
*not* copyable. The (perhaps) underlying RE2 object is not copyable either,
and for a good reason: The object might be very costly to copy, and we want
to avoid accidental copies.
Change-Id: Ie87a58753437a443c80450465feb8fd61699b8c3
---
livestatus/src/RegExp.cc | 4 ++++
livestatus/src/RegExp.h | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/livestatus/src/RegExp.cc b/livestatus/src/RegExp.cc
index bac70a7..96d5f3e 100644
--- a/livestatus/src/RegExp.cc
+++ b/livestatus/src/RegExp.cc
@@ -95,6 +95,10 @@ RegExp::RegExp(const std::string &str, Case c)
RegExp::~RegExp() = default;
+RegExp::RegExp(RegExp &&rhs) noexcept = default;
+
+RegExp &RegExp::operator=(RegExp &&rhs) noexcept = default;
+
std::string RegExp::replace(const std::string &str,
const std::string &replacement) const {
return _impl->replace(str, replacement);
diff --git a/livestatus/src/RegExp.h b/livestatus/src/RegExp.h
index 216e642..3e6b77e 100644
--- a/livestatus/src/RegExp.h
+++ b/livestatus/src/RegExp.h
@@ -40,8 +40,8 @@ public:
~RegExp();
RegExp(const RegExp &rhs) = delete;
RegExp &operator=(const RegExp &rhs) = delete;
- RegExp(RegExp &&rhs) = delete;
- RegExp &operator=(RegExp &&rhs) = delete;
+ RegExp(RegExp &&rhs) noexcept;
+ RegExp &operator=(RegExp &&rhs) noexcept;
std::string replace(const std::string &str,
const std::string &replacement) const;