tool-regex.inline.h 471 B

1234567891011121314151617181920
  1. #ifndef AFUN_TOOL_REGEX_INLINE_H
  2. #define AFUN_TOOL_REGEX_INLINE_H
  3. #include "tool-regex.h"
  4. namespace aFuntool {
  5. inline Regex::Regex(const Regex &regex) noexcept: Regex(regex.pattern) {
  6. }
  7. inline Regex::Regex(Regex &&regex) noexcept : pattern {std::move(regex.pattern)}, re {regex.re} {
  8. regex.re = nullptr;
  9. }
  10. Regex::~Regex() noexcept {
  11. if (re != nullptr)
  12. pcre2_code_free(re);
  13. }
  14. }
  15. #endif //AFUN_TOOL_REGEX_INLINE_H