📄 wy_array.3wy
字号:
Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from ~T(),T(const T&).PP [\fBThrow\fP] Reply Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void reset(const WySeg<T>& " "seg" ")" .PP Reconstruct *this to the state as Wy_Array<T>(\fIseg\fP). Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from ~T(),T(const T&).PP [\fBThrow\fP] Reply Wym_ELOOP *this and \fIstr\fP would overlap Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void reset(size_t " "n_elem" ", const T& " "elem" ")".PP Reconstruct *this to the state as Wy_Array<T>(\fIn_elem\fP,\fIelem\fP). [\fBEffect\fP] begin()= Pointer to an allocated dynamic array, or intact size() = \fIn_elem\fP end() = begin()+size() Note: _capacity()>= \fIn_elem\fP and min_capacity().PP [\fBThrow\fP] from T(const T&), ~T().PP [\fBThrow\fP] Reply Wym_EFBIG Capacity would exceed the maximum Wym_ENOMEM Not enough memory.\"--------------------------------------------.PP.BI "const Wy_Array<T>& operator= (const Wy_Array<T>& " "src" ")" .PP Assign *this from \fIsrc\fP Note: This member requires element type T have operator=(const T&) defined. Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from ~T(),T(const T&),operator=(const T&).PP [\fBThrow\fP] Reply Wym_ENOMEM Not enough memory for reallocation.PP [\fBRet\fP] Reference of *this.\"--------------------------------------------.PP.BI "const Wy_Array<T>& operator= (const WySeg<T>& " "seg" ")" .PP Reconstruct *this to the state as Wy_Array<T>(\fIseg\fP). Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from ~T(),T(const T&).PP [\fBThrow\fP] Reply Wym_ELOOP *this and \fIstr\fP would overlap Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void swap(Wy_Array<T>& " "v" ") throw()".PP Interchange state of *this with that of \fIv\fP Note: Previously output pointers and references are invalidated.\"--------------------------------------------.PP.BI "void push_back(const T& " "elem" ")".PP Append(construct) element T(\fIelem\fP) at the end of the array Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from T(const T&).PP [\fBThrow\fP] Reply Wym_EFBIG Capacity would exceed the maximum Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void pop_back(void)".PP Remove and destruct the last element of the array. If the array contains no element, this member has no effect..PP [\fBThrow\fP] from ~T().\"--------------------------------------------.PP.BI "void erase(size_t " "idx" ", size_t " "n" ")".PP Erase at most \fIn\fP elements from position \fIidx\fP. Elements of position larger than that of the erased(destructed) are moved to occupy the position of destructed elements, with order preserved..PP [\fBThrow\fP] from ~T().PP [\fBThrow\fP] Reply Wym_EINVAL \fIidx\fP > this->size().\"--------------------------------------------.PP.BI "void insert(size_t " "idx" ", const T& " "elem" ")".PP Insert an element T(\fIelem\fP) at position \fIidx\fP of *this. Existing elements from \fIidx\fP to the last are each of position i moved to position i+1. Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from T(const T&), ~T().PP [\fBThrow\fP] Reply Wym_EINVAL \fIidx\fP > this->size() Wym_EFBIG Capacity would exceed the maximum Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void insert(size_t " "idx" ", size_t " "n_elem" ", const T& " "elem" ")".PP Insert number \fIn_elem\fP of elements T(\fIelem\fP) at position \fIidx\fP of *this. Existing elements from \fIidx\fP to the last are each of position i moved to position i+\fIn_elem\fP. Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from T(const T&), ~T().PP [\fBThrow\fP] Reply Wym_EINVAL \fIidx\fP > this->size() Wym_EFBIG Capacity would exceed the maximum Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void insert(size_t " "idx" ", const WySeg<T>& " "seg" ")".PP Insert the elements pointed by \fIseg\fP to the position \fIidx\fP of *this. Existing elements from \fIidx\fP to the last are each of position i moved to position i+\fIseg\fP.size(). Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from T(const T&), ~T().PP [\fBThrow\fP] Reply Wym_EINVAL \fIidx\fP > this->size() Wym_ELOOP *this and \fIseg\fP would overlap Wym_EFBIG Capacity would exceed the maximum Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void insert(size_t " "idx" ", const Wy_Array<T>& " "src" ")".PP Insert the elements in \fIsrc\fP to the position \fIidx\fP. Existing elements from \fIidx\fP to the last are each of position i moved to position i+\fIsrc\fP.size(). Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from T(const T&), ~T().PP [\fBThrow\fP] Reply Wym_EINVAL \fIidx\fP > this->size() Wym_ELOOP *this and \fIsrc\fP would overlap Wym_EFBIG Capacity would exceed the maximum Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void replace(size_t " "idx" ", size_t " "len" ", size_t " "n_elem, " "const T& " "elem" ")".PP Replace at most \fIlen\fP elements of the array from position \fIidx\fP with number \fIn_elem\fP of elements T(\fIelem\fP) Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from T(const T&),~T.PP [\fBThrow\fP] Reply Wym_EINVAL \fIidx\fP > this->size() Wym_EFBIG Capacity would exceed the maximum Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void resize(size_t " "nsize" ")".PP Change size of the array to \fInsize\fP. If \fInsize\fP is greater than the current size, T() pads the lengthened array (reallocation may occur), otherwise elements of position larger than or equal to \fInsize\fP are destroyed. Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from T(),~T().PP [\fBThrow\fP] Reply Wym_EFBIG Capacity would exceed the maximum Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "void resize(size_t " "nsize" ", const T& " "elem" ")".PP Change size of the array to \fInsize\fP. If \fInsize\fP is greater than the current size, T(\fIelem\fP) pads the lengthened array (reallocation may occur), otherwise elements of position larger than or equal to \fInsize\fP are destroyed. Note: Reallocation of the dynamic array occurs iff the resultant size would exceed the current capacity. If reallocation occurred, the previously output pointers and references are implicitly undefined..PP [\fBThrow\fP] from T(const T&),~T().PP [\fBThrow\fP] Reply Wym_EFBIG Capacity would exceed the maximum Wym_ENOMEM Not enough memory for reallocation.\"--------------------------------------------.PP.BI "bool operator ==(const Wy_Array<T>& " "rhs" ") const".PP Get equivalence relation of *this and \fIrhs\fP if the element type T has operator== defined. v1 and v2 are equivalent iff both have the same size and for all valid position i, v1[i]==v2[i] yields true. Note: The returned objects of members begin(), end(), subseg() of two equivalent Wy_Array<T> objects need not be equivalent, but the pointed elements are equivalent. Note: Capacity is irrelevant to object equivalence..PP [\fBThrow\fP] from T::operator==(const T&).PP [\fBRet\fP] true= *this and \fIrhs\fP are equivalent false= otherwise.\"--------------------------------------------.PP.BI "bool operator !=(const Wy_Array<T>& " "rhs" ") const".PP Get non-equivalence relation of *this and \fIrhs\fP if the element type T has operator!= defined. v1 and v2 are non-equivalent iff v1,v2 are different size or there exists one valid position i, v1[i]!=v2[i] yields true. Note: Capacity is irrelevant to object equivalence..PP [\fBThrow\fP] from T::operator!=(const T&).PP [\fBRet\fP] true= *this and \fIrhs\fP are not equivalent false= otherwise.\"--------------------------------------------.PP.BI "size_t _capacity(void) const throw()".PP Get the number of elements this array can hold without causing reallocation..PP [\fBRet\fP] The number of elements this array can hold without causing reallocation.\"--------------------------------------------.PP.BI "WyRet _reserve(size_t " "cap" ") throw()".PP Reserve at least \fIcap\fP elements of capacity *this capacity never shrinks by this member. Use Wy_Array<T>(v).swap(v) to shrink capacity of v to currently needed minimum(may throw from reallocation).PP [\fBRet\fP] Ok Succeed Wym_EFBIG \fIcap\fP > max_capacity() Wym_ENOMEM Not enough memory.\"--------------------------------------------.PP.BI "static size_t max_capacity(void) throw()".PP Get the maximal number of elements this class can hold..PP [\fBRet\fP] The maximal number of elements this class can hold..\"--------------------------------------------.PP.BI "static size_t min_capacity(void) throw()".PP Get the minimal number of elements this class can be..PP [\fBRet\fP] The minimal number of elements this class can be..\"--------------------------------------------.SH "SEE ALSO".BR wyret.BR wystr.BR wyseg.BR wytimespec.BR wybyteflow.BR wyregfile.BR wymutex.SH NOTEProject is in development, http://sourceforge.net/projects/libwx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -