When cells have id, store the max id.

This commit is contained in:
Guillaume Damiand 2021-10-14 17:48:43 +02:00
parent 5c57f83fda
commit f21ab5a1a1
1 changed files with 18 additions and 5 deletions

View File

@ -14,6 +14,7 @@
#include <CGAL/tags.h>
#include <CGAL/assertions.h>
#include <cstddef>
namespace CGAL {
@ -83,15 +84,27 @@ namespace CGAL {
const std::size_t& id() const
{ return m_id; }
protected:
void set_id(std::size_t id)
{ m_id=id; }
static const std::size_t& max_id()
{ return m_max_id; }
protected:
/// id of the cell
std::size_t m_id;
void set_id(std::size_t id)
{
m_id=id;
if (m_id+1>m_max_id) { m_max_id=m_id+1; }
}
static void reset_max_id()
{ m_max_id=0; }
protected:
std::size_t m_id; ///< id of the cell
static std::size_t m_max_id; ///< max id used (warning: never decreases)
};
template <class WithId>
std::size_t Add_id<WithId>::m_max_id=0;
/// If the tag WithId is false, we do not add id to cells.
template <>
class Add_id<Tag_false>