refactor(util/name_set): implement name_sets using red black trees instead of hashtables

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-04-22 11:09:13 -07:00
parent cc1cfba8ad
commit ad43d9177b
2 changed files with 3 additions and 3 deletions

View file

@ -11,7 +11,7 @@ name mk_unique(name_set const & s, name const & suggestion) {
name n = suggestion;
int i = 1;
while (true) {
if (s.find(n) == s.end())
if (!s.contains(n))
return n;
n = name(suggestion, i);
i++;

View file

@ -5,10 +5,10 @@ Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#pragma once
#include <unordered_set>
#include "util/rb_tree.h"
#include "util/name.h"
namespace lean {
typedef std::unordered_set<name, name_hash, name_eq> name_set;
typedef rb_tree<name, name_quick_cmp> name_set;
/**
\brief Make a name that does not occur in \c s, based on
the given suggestion.