BLI: add index_range method to some data structures
This can be used to iterate over all indices with less code.
This commit is contained in:
@@ -246,6 +246,11 @@ template<typename T> class ArrayRef {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
IndexRange index_range() const
|
||||
{
|
||||
return IndexRange(m_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new array ref to the same underlying memory buffer. No conversions are done.
|
||||
* Asserts when the sizes of the types don't match.
|
||||
@@ -411,6 +416,11 @@ template<typename T> class MutableArrayRef {
|
||||
{
|
||||
return ArrayRef<T>(m_start, m_size);
|
||||
}
|
||||
|
||||
IndexRange index_range() const
|
||||
{
|
||||
return IndexRange(m_size);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user