mirror of https://github.com/CGAL/cgal
When cells have id, store the max id.
This commit is contained in:
parent
5c57f83fda
commit
f21ab5a1a1
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <CGAL/tags.h>
|
#include <CGAL/tags.h>
|
||||||
#include <CGAL/assertions.h>
|
#include <CGAL/assertions.h>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
|
|
@ -83,15 +84,27 @@ namespace CGAL {
|
||||||
const std::size_t& id() const
|
const std::size_t& id() const
|
||||||
{ return m_id; }
|
{ return m_id; }
|
||||||
|
|
||||||
protected:
|
static const std::size_t& max_id()
|
||||||
void set_id(std::size_t id)
|
{ return m_max_id; }
|
||||||
{ m_id=id; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// id of the cell
|
void set_id(std::size_t id)
|
||||||
std::size_t m_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.
|
/// If the tag WithId is false, we do not add id to cells.
|
||||||
template <>
|
template <>
|
||||||
class Add_id<Tag_false>
|
class Add_id<Tag_false>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue