refactor(util/splay_map): remove unnecessary operation

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-02-21 17:22:56 -08:00
parent 528ea367ad
commit 1ab12eb105
2 changed files with 0 additions and 26 deletions

View file

@ -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;
}

View file

@ -65,14 +65,6 @@ public:
*/
ref operator[](K const & k) { return ref(*this, k); }
template<typename F, typename R>
R fold(F f, R r) const {
static_assert(std::is_same<typename std::result_of<F(K const &, T const &, R const &)>::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<typename F>
void for_each(F f) const {
static_assert(std::is_same<typename std::result_of<F(K const &, T const &)>::type, void>::value,
@ -103,12 +95,6 @@ splay_map<K, T, CMP> erase(splay_map<K, T, CMP> const & m, K const & k) {
r.erase(k);
return r;
}
template<typename K, typename T, typename CMP, typename F, typename R>
R fold(splay_map<K, T, CMP> const & m, F f, R r) {
static_assert(std::is_same<typename std::result_of<F(K const &, T const &, R const &)>::type, R>::value,
"fold: return type of f(k : K, t : T, r : R) is not R");
return m.fold(f, r);
}
template<typename K, typename T, typename CMP, typename F>
void for_each(splay_map<K, T, CMP> const & m, F f) {
static_assert(std::is_same<typename std::result_of<F(K const &, T const &)>::type, void>::value,