Have SkTArray state that it default-initializes.

The current comments in SkTArray lead one to believe that it is default
constructing all types. However, it is not calling the default
constructor for primitive types, it is actually default-initializing.

R=bsalomon@google.com

Review URL: https://codereview.chromium.org/208393006

git-svn-id: http://skia.googlecode.com/svn/trunk@13909 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bungeman@google.com 2014-03-24 15:55:01 +00:00
parent 61c9b835d1
commit d58a856418

View File

@ -53,7 +53,7 @@ template <typename T, bool MEM_COPY> void* operator new(size_t, SkTArray<T, MEM_
/** When MEM_COPY is true T will be bit copied when moved.
When MEM_COPY is false, T will be copy constructed / destructed.
In all cases T's constructor will be called on allocation,
In all cases T will be default-initialized on allocation,
and its destructor will be called from this object's destructor.
*/
template <typename T, bool MEM_COPY> class SkTArray {
@ -173,7 +173,7 @@ public:
bool empty() const { return !fCount; }
/**
* Adds 1 new default-constructed T value and returns in by reference. Note
* Adds 1 new default-initialized T value and returns it by reference. Note
* the reference only remains valid until the next call that adds or removes
* elements.
*/
@ -193,9 +193,9 @@ public:
}
/**
* Allocates n more default T values, and returns the address of the start
* of that new range. Note: this address is only valid until the next API
* call made on the array that might add or remove elements.
* Allocates n more default-initialized T values, and returns the address of
* the start of that new range. Note: this address is only valid until the
* next API call made on the array that might add or remove elements.
*/
T* push_back_n(int n) {
SkASSERT(n >= 0);