Move out invalid_id constant from MutablePriotityQueue template class
Enclose it into Slic3r namespace
This commit is contained in:
parent
db8a120953
commit
4f8535d0d5
2 changed files with 10 additions and 2 deletions
|
@ -7,6 +7,10 @@
|
|||
#include <limits>
|
||||
#include <cstdlib> // adds size_t (without std::)
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
constexpr auto InvalidQueueID = std::numeric_limits<size_t>::max();
|
||||
|
||||
template<typename T, typename IndexSetter, typename LessPredicate, const bool ResetIndexWhenRemoved = false>
|
||||
class MutablePriorityQueue
|
||||
{
|
||||
|
@ -41,7 +45,7 @@ public:
|
|||
bool empty() const { return m_heap.empty(); }
|
||||
T& operator[](std::size_t idx) noexcept { return m_heap[idx]; }
|
||||
const T& operator[](std::size_t idx) const noexcept { return m_heap[idx]; }
|
||||
static constexpr size_t invalid_id() { return std::numeric_limits<size_t>::max(); }
|
||||
static constexpr size_t invalid_id() { return InvalidQueueID; }
|
||||
|
||||
using iterator = typename std::vector<T>::iterator;
|
||||
using const_iterator = typename std::vector<T>::const_iterator;
|
||||
|
@ -291,7 +295,7 @@ public:
|
|||
bool empty() const { return m_heap.empty(); }
|
||||
T& operator[](std::size_t idx) noexcept { assert(! address::is_padding(idx)); return m_heap[idx]; }
|
||||
const T& operator[](std::size_t idx) const noexcept { assert(! address::is_padding(idx)); return m_heap[idx]; }
|
||||
static constexpr size_t invalid_id() { return std::numeric_limits<size_t>::max(); }
|
||||
static constexpr size_t invalid_id() { return InvalidQueueID; }
|
||||
|
||||
protected:
|
||||
void update_heap_up(size_t top, size_t bottom);
|
||||
|
@ -450,4 +454,6 @@ inline void MutableSkipHeapPriorityQueue<T, LessPredicate, IndexSetter, blocking
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif /* slic3r_MutablePriorityQueue_hpp_ */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "libslic3r/MutablePriorityQueue.hpp"
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
// based on https://raw.githubusercontent.com/rollbear/prio_queue/master/self_test.cpp
|
||||
// original source Copyright Björn Fahller 2015, Boost Software License, Version 1.0, http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
|
Loading…
Reference in a new issue