Displaying 2 results from an estimated 2 matches for "smallvector2".
Did you mean:
smallvector
2018 Jun 21
4
RFC: Should SmallVectors be smaller?
...{ return BeginX == Small; }
T *begin() { return BeginX; }
T *end() { return EndX; }
size_t size() const { return EndX - BeginX; }
size_t capacity() const { return CapacityX - BeginX; }
};
```
In the past I used something more like:
```
template <class T, size_t SmallCapacity>
struct SmallVector2 {
unsigned Size;
unsigned Capacity;
union {
T Small[SmallCapacity];
T *Large;
};
bool isSmall() const { return Capacity == SmallCapacity; } // Or a bit shaved off of Capacity.
T *begin() { return isSmall() ? Small : Large; }
T *end() { return begin() + Size; }
size_t size()...
2018 Jun 22
3
RFC: Should SmallVectors be smaller?
...urn EndX; }
>> size_t size() const { return EndX - BeginX; }
>> size_t capacity() const { return CapacityX - BeginX; }
>> };
>> ```
>>
>> In the past I used something more like:
>> ```
>> template <class T, size_t SmallCapacity>
>> struct SmallVector2 {
>> unsigned Size;
>> unsigned Capacity;
>> union {
>> T Small[SmallCapacity];
>> T *Large;
>> };
>>
>> bool isSmall() const { return Capacity == SmallCapacity; } // Or a bit shaved off of Capacity.
>> T *begin() { return isSmall() ? Small...