wip
This commit is contained in:
parent
53032e556a
commit
49f875c0f8
@ -124,7 +124,7 @@ template <typename NodeID, typename Key> class UnorderedMapStorage
|
||||
private:
|
||||
template <typename K, typename V>
|
||||
using UnorderedMap = std::
|
||||
unordered_map<K, V/*, std::hash<K>, std::equal_to<K>, PoolAllocator<std::pair<const K, V>>*/>;
|
||||
unordered_map<K, V, std::hash<K>, std::equal_to<K>, PoolAllocator<std::pair<const K, V>>>;
|
||||
|
||||
UnorderedMap<NodeID, Key> nodes;
|
||||
};
|
||||
@ -190,53 +190,6 @@ class TwoLevelStorage
|
||||
OverlayIndexStorage<NodeID, Key> overlay;
|
||||
};
|
||||
|
||||
template <typename T> class LoggingAllocator
|
||||
{
|
||||
public:
|
||||
using value_type = T;
|
||||
|
||||
LoggingAllocator() noexcept = default;
|
||||
template <typename U> LoggingAllocator(const LoggingAllocator<U> &) noexcept {}
|
||||
|
||||
T *allocate(std::size_t n)
|
||||
{
|
||||
if (n == 1024)
|
||||
{
|
||||
std::cerr << "bingo\n";
|
||||
}
|
||||
|
||||
auto p = std::allocator<T>().allocate(n);
|
||||
if (n != 1)
|
||||
{
|
||||
std::cout << "Allocated " << n << " element(s) of size " << sizeof(T) << " at "
|
||||
<< static_cast<void *>(p) << std::endl;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void deallocate(T *p, std::size_t n) noexcept
|
||||
{
|
||||
// std::cout << "Deallocated " << n << " element(s) at " << static_cast<void*>(p) <<
|
||||
// std::endl;
|
||||
std::allocator<T>().deallocate(p, n);
|
||||
}
|
||||
|
||||
template <typename U, typename... Args> void construct(U *p, Args &&...args)
|
||||
{
|
||||
std::allocator<T> a;
|
||||
// std::cout << "Constructing object at " << static_cast<void*>(p) << std::endl;
|
||||
std::allocator_traits<std::allocator<T>>::construct(a, p, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename U> void destroy(U *p)
|
||||
{
|
||||
// std::cout << "Destroying object at " << static_cast<void*>(p) << std::endl;
|
||||
std::allocator<T> a;
|
||||
std::allocator_traits<std::allocator<T>>::destroy(a, p);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename NodeID,
|
||||
typename Key,
|
||||
typename Weight,
|
||||
|
Loading…
Reference in New Issue
Block a user