mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 21:16:02 +01:00
replace more std::unordered_* types by faster boost hash maps
This commit is contained in:
parent
4f8c50fb77
commit
9f2b6a1b94
17 changed files with 75 additions and 71 deletions
|
|
@ -4571,11 +4571,13 @@ struct RegexCache
|
|||
std::regex regex;
|
||||
/* No std::regex constructor overload from std::string_view, but can be constructed
|
||||
from a pointer + size or an iterator range. */
|
||||
cache.try_emplace_and_cvisit(re,
|
||||
/*s=*/re.data(), /*count=*/re.size(), std::regex::extended,
|
||||
cache.try_emplace_and_cvisit(
|
||||
re,
|
||||
/*s=*/re.data(),
|
||||
/*count=*/re.size(),
|
||||
std::regex::extended,
|
||||
[®ex](const auto & kv) { regex = kv.second; },
|
||||
[®ex](const auto & kv) { regex = kv.second; }
|
||||
);
|
||||
[®ex](const auto & kv) { regex = kv.second; });
|
||||
return regex;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include <limits>
|
||||
#include <unordered_set>
|
||||
#include <sstream>
|
||||
|
||||
#include "nix/expr/print.hh"
|
||||
|
|
@ -10,6 +9,8 @@
|
|||
#include "nix/util/english.hh"
|
||||
#include "nix/expr/eval.hh"
|
||||
|
||||
#include <boost/unordered/unordered_flat_set.hpp>
|
||||
|
||||
namespace nix {
|
||||
|
||||
void printElided(
|
||||
|
|
@ -81,7 +82,7 @@ std::ostream & printLiteralBool(std::ostream & str, bool boolean)
|
|||
// For example `or' doesn't need to be quoted.
|
||||
bool isReservedKeyword(const std::string_view str)
|
||||
{
|
||||
static const std::unordered_set<std::string_view> reservedKeywords = {
|
||||
static const boost::unordered_flat_set<std::string_view> reservedKeywords = {
|
||||
"if", "then", "else", "assert", "with", "let", "in", "rec", "inherit"};
|
||||
return reservedKeywords.contains(str);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue