/** * Represents an array of `T` (must be a trivial type) that cannot grow past a fixed size `N`. * The fixed-size restriction allows for tighter codegen and a smaller memory footprint. * Missing methods from TArray (e.g. `fromBack`) can be added on demand. * * The trivial-type restriction is only to simplify implementation; if there is a need, we can * adopt proper move/copy semantics in this class as well.
*/ template <int N, typename T> class FixedArray { public: using value_type = T;
FixedArray() = default;
FixedArray(std::initializer_list<T> values) {
SkASSERT(values.size() <= N); for (T value : values) {
fData[fSize++] = value;
}
}
FixedArray(int reserveCount) { // This is here to satisfy the TArray interface. Setting a reserve count on a fixed array // isn't useful.
SkASSERT(reserveCount >= 0);
SkASSERT(reserveCount <= N);
}
FixedArray(const T* array, int count) {
this->reset(array, count);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.