From 358aebec4d3cc8e50f9914a80264ed0dfc564d31 Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Tue, 2 May 2017 11:05:00 +0200 Subject: [PATCH] Decrease memory footprint of HeapHandle from 32 to 24 bytes --- include/util/binary_heap.hpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/include/util/binary_heap.hpp b/include/util/binary_heap.hpp index c2ce2785a..c7d3f962b 100644 --- a/include/util/binary_heap.hpp +++ b/include/util/binary_heap.hpp @@ -156,7 +156,7 @@ class BinaryHeap { const auto index = static_cast(inserted_nodes.size()); const auto handle = heap.push(std::make_pair(weight, index)); - inserted_nodes.emplace_back(node, handle, weight, data); + inserted_nodes.emplace_back(HeapNode{handle, node, weight, data}); node_index[node] = index; } @@ -241,16 +241,10 @@ class BinaryHeap boost::heap::compare>>; using HeapHandle = typename HeapContainer::handle_type; - class HeapNode + struct HeapNode { - public: - HeapNode(NodeID n, HeapHandle h, Weight w, Data d) - : node(n), handle(h), weight(w), data(std::move(d)) - { - } - - NodeID node; HeapHandle handle; + NodeID node; Weight weight; Data data; };