Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SiarheiFedartsou committed Jun 9, 2024
1 parent 2e3f3e9 commit 3d9e66c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ if(ENABLE_CONAN)
KEEP_RPATHS
NO_OUTPUT_DIRS
OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake
# onetbb:shared=${TBB_SHARED}
onetbb:shared=${TBB_SHARED}
boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it
BUILD missing
)
Expand Down
29 changes: 1 addition & 28 deletions include/util/query_heap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,10 @@ template <typename NodeID, typename Key> class ArrayStorage
std::vector<Key> positions;
};

template <typename NodeID, typename Key> class MapStorage
{
public:
explicit MapStorage(std::size_t) {}

Key &operator[](NodeID node) { return nodes[node]; }

void Clear() { nodes.clear(); }

Key peek_index(const NodeID node) const
{
const auto iter = nodes.find(node);
if (nodes.end() != iter)
{
return iter->second;
}
return std::numeric_limits<Key>::max();
}

private:
std::map<NodeID, Key> nodes;
};

template <typename NodeID, typename Key> class UnorderedMapStorage
{
public:
explicit UnorderedMapStorage(std::size_t)
{
// nodes.rehash(1000);
}
explicit UnorderedMapStorage(std::size_t size) { nodes.reserve(size); }

Key &operator[](const NodeID node) { return nodes[node]; }

Expand All @@ -84,7 +58,6 @@ template <typename NodeID, typename Key> class UnorderedMapStorage

private:
ankerl::unordered_dense::map<NodeID, Key> nodes;
// std::unordered_map<NodeID, Key> nodes;
};

template <typename NodeID,
Expand Down
5 changes: 2 additions & 3 deletions unit_tests/util/query_heap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ struct TestData
using TestNodeID = NodeID;
using TestKey = int;
using TestWeight = int;
using storage_types = boost::mpl::list<ArrayStorage<TestNodeID, TestKey>,
MapStorage<TestNodeID, TestKey>,
UnorderedMapStorage<TestNodeID, TestKey>>;
using storage_types =
boost::mpl::list<ArrayStorage<TestNodeID, TestKey>, UnorderedMapStorage<TestNodeID, TestKey>>;

template <unsigned NUM_ELEM> struct RandomDataFixture
{
Expand Down

0 comments on commit 3d9e66c

Please sign in to comment.