mirror of
https://github.com/NixOS/nix
synced 2025-07-06 09:11:47 +02:00
Alias traceable_allocator to std::allocator when building without GC
This allows us to get rid of a bunch of #ifdefs.
This commit is contained in:
parent
ca3fc1693b
commit
b9f78abb7f
7 changed files with 8 additions and 52 deletions
|
@ -12,7 +12,11 @@
|
|||
|
||||
#if HAVE_BOEHMGC
|
||||
#include <gc/gc_allocator.h>
|
||||
#else
|
||||
template<typename T>
|
||||
using traceable_allocator = std::allocator<T>;
|
||||
#endif
|
||||
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
namespace nix {
|
||||
|
@ -498,15 +502,9 @@ void Value::mkBlackhole()
|
|||
}
|
||||
|
||||
|
||||
#if HAVE_BOEHMGC
|
||||
typedef std::vector<Value *, traceable_allocator<Value *>> ValueVector;
|
||||
typedef std::unordered_map<Symbol, Value *, std::hash<Symbol>, std::equal_to<Symbol>, traceable_allocator<std::pair<const Symbol, Value *>>> ValueMap;
|
||||
typedef std::map<Symbol, ValueVector, std::less<Symbol>, traceable_allocator<std::pair<const Symbol, ValueVector>>> ValueVectorMap;
|
||||
#else
|
||||
typedef std::vector<Value *> ValueVector;
|
||||
typedef std::unordered_map<Symbol, Value *> ValueMap;
|
||||
typedef std::map<Symbol, ValueVector> ValueVectorMap;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue