From fa2f6c9206dcce923af05d2e8b7275cd804f3b79 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 21 Jan 2020 15:11:45 +0100 Subject: [PATCH] macro processor: use `map.count()` instead of `map.find()` --- src/macro/Environment.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macro/Environment.cc b/src/macro/Environment.cc index 76e34ab7..822c03c6 100644 --- a/src/macro/Environment.cc +++ b/src/macro/Environment.cc @@ -26,7 +26,7 @@ void Environment::define(VariablePtr var, ExpressionPtr value) { string name = var->getName(); - if (functions.find(name) != functions.end()) + if (functions.count(name)) throw StackTrace("Variable " + name + " was previously defined as a function"); variables[move(name)] = value->eval(); } @@ -35,7 +35,7 @@ void Environment::define(FunctionPtr func, ExpressionPtr value) { string name = func->getName(); - if (variables.find(name) != variables.end()) + if (variables.count(name)) throw StackTrace("Variable " + name + " was previously defined as a variable"); functions[name] = {move(func), move(value)}; }