From 1ab12eb10584925d97a10e2c2d0dda4a8a71c341 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Fri, 21 Feb 2014 17:22:56 -0800 Subject: [PATCH] refactor(util/splay_map): remove unnecessary operation Signed-off-by: Leonardo de Moura --- src/tests/util/splay_map.cpp | 12 ------------ src/util/splay_map.h | 14 -------------- 2 files changed, 26 deletions(-) diff --git a/src/tests/util/splay_map.cpp b/src/tests/util/splay_map.cpp index 9d8ffb63c..9e9deeef1 100644 --- a/src/tests/util/splay_map.cpp +++ b/src/tests/util/splay_map.cpp @@ -33,17 +33,6 @@ static void tst0() { } static void tst1() { - int2name m; - m[10] = name("t1"); - m[20] = name("t2"); - lean_assert(fold(m, [](int k, name const &, int a) { return k + a; }, 0) == 30); - std::ostringstream out; - for_each(m, [&](int, name const & v) { out << v << " "; }); - std::cout << out.str() << "\n"; - lean_assert(out.str() == "t1 t2 "); -} - -static void tst2() { int2name m1, m2; m1[10] = name("t1"); lean_assert(m1.size() == 1); @@ -56,6 +45,5 @@ static void tst2() { int main() { tst0(); tst1(); - tst2(); return has_violations() ? 1 : 0; } diff --git a/src/util/splay_map.h b/src/util/splay_map.h index fd142b77d..a19d623eb 100644 --- a/src/util/splay_map.h +++ b/src/util/splay_map.h @@ -65,14 +65,6 @@ public: */ ref operator[](K const & k) { return ref(*this, k); } - template - R fold(F f, R r) const { - static_assert(std::is_same::type, R>::value, - "fold: return type of f(k : K, t : T, r : R) is not R"); - auto f_prime = [&](entry const & e, R r) -> R { return f(e.first, e.second, r); }; - return m_map.fold(f_prime, r); - } - template void for_each(F f) const { static_assert(std::is_same::type, void>::value, @@ -103,12 +95,6 @@ splay_map erase(splay_map const & m, K const & k) { r.erase(k); return r; } -template -R fold(splay_map const & m, F f, R r) { - static_assert(std::is_same::type, R>::value, - "fold: return type of f(k : K, t : T, r : R) is not R"); - return m.fold(f, r); -} template void for_each(splay_map const & m, F f) { static_assert(std::is_same::type, void>::value,