mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:48:44 +02:00
reimplement buffer get for (c)end
This commit is contained in:
parent
d1fb723b01
commit
813fefd599
1 changed files with 10 additions and 2 deletions
|
@ -293,10 +293,18 @@ public:
|
||||||
template <typename T> Iterator<T> end() { return Iterator<T>(&edit<T>(getNum<T>()), _stride); }
|
template <typename T> Iterator<T> end() { return Iterator<T>(&edit<T>(getNum<T>()), _stride); }
|
||||||
#else
|
#else
|
||||||
template <typename T> Iterator<const T> begin() const { return Iterator<const T>(&get<T>(), _stride); }
|
template <typename T> Iterator<const T> begin() const { return Iterator<const T>(&get<T>(), _stride); }
|
||||||
template <typename T> Iterator<const T> end() const { return Iterator<const T>(&get<T>(getNum<T>()), _stride); }
|
template <typename T> Iterator<const T> end() const {
|
||||||
|
// reimplement get<T> without bounds checking
|
||||||
|
Resource::Size elementOffset = getNum<T>() * _stride + _offset;
|
||||||
|
return Iterator<const T>((reinterpret_cast<const T*> (_buffer->getData() + elementOffset)), _stride);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
template <typename T> Iterator<const T> cbegin() const { return Iterator<const T>(&get<T>(), _stride); }
|
template <typename T> Iterator<const T> cbegin() const { return Iterator<const T>(&get<T>(), _stride); }
|
||||||
template <typename T> Iterator<const T> cend() const { return Iterator<const T>(&get<T>(getNum<T>()), _stride); }
|
template <typename T> Iterator<const T> cend() const {
|
||||||
|
// reimplement get<T> without bounds checking
|
||||||
|
Resource::Size elementOffset = getNum<T>() * _stride + _offset;
|
||||||
|
return Iterator<const T>((reinterpret_cast<const T*> (_buffer->getData() + elementOffset)), _stride);
|
||||||
|
}
|
||||||
|
|
||||||
// the number of elements of the specified type fitting in the view size
|
// the number of elements of the specified type fitting in the view size
|
||||||
template <typename T> Index getNum() const {
|
template <typename T> Index getNum() const {
|
||||||
|
|
Loading…
Reference in a new issue