Added a couple of methods to enable more efficient adding of batches of vertices.

This commit is contained in:
Hans-Christian Ebke
2015-12-20 23:07:54 +01:00
parent 011fdc9700
commit 8ece0770a3
4 changed files with 42 additions and 0 deletions

View File

@@ -200,6 +200,22 @@ public:
//---------------------------------------------------- synchronize properties
#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && !defined(OPENMESH_VECTOR_LEGACY)
void reserve(size_t _n) const {
std::for_each(properties_.begin(), properties_.end(),
[_n](BaseProperty* p) { if (p) p->reserve(_n); });
}
void resize(size_t _n) const {
std::for_each(properties_.begin(), properties_.end(),
[_n](BaseProperty* p) { if (p) p->resize(_n); });
}
void swap(size_t _i0, size_t _i1) const {
std::for_each(properties_.begin(), properties_.end(),
[_i0, _i1](BaseProperty* p) { if (p) p->swap(_i0, _i1); });
}
#else
void reserve(size_t _n) const {
std::for_each(properties_.begin(), properties_.end(), Reserve(_n));
}
@@ -211,6 +227,7 @@ public:
void swap(size_t _i0, size_t _i1) const {
std::for_each(properties_.begin(), properties_.end(), Swap(_i0, _i1));
}
#endif