From ffc61e8a68e95a57bcbfc76ad40fdeac9d7d0389 Mon Sep 17 00:00:00 2001 From: yhirose Date: Tue, 2 Jun 2020 09:15:45 -0400 Subject: [PATCH] Removed unnecessary code --- peglib.h | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/peglib.h b/peglib.h index df77692..fbd909c 100644 --- a/peglib.h +++ b/peglib.h @@ -553,10 +553,13 @@ struct SemanticValues : protected std::vector { // Transform the semantic value vector to another vector template - auto transform(size_t beg = 0, size_t end = static_cast(-1)) const - -> vector { - return this->transform(beg, end, - [](const any &v) { return any_cast(v); }); + std::vector transform(size_t beg = 0, size_t end = static_cast(-1)) const { + std::vector r; + end = (std::min)(end, size()); + for (size_t i = beg; i < end; i++) { + r.emplace_back(any_cast((*this)[i])); + } + return r; } using std::vector::iterator; @@ -594,27 +597,6 @@ private: size_t choice_count_ = 0; size_t choice_ = 0; std::string name_; - - template - auto transform(F f) const - -> vector::type> { - vector::type> r; - for (const auto &v : *this) { - r.emplace_back(f(v)); - } - return r; - } - - template - auto transform(size_t beg, size_t end, F f) const - -> vector::type> { - vector::type> r; - end = (std::min)(end, size()); - for (size_t i = beg; i < end; i++) { - r.emplace_back(f((*this)[i])); - } - return r; - } }; /*