⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wcvectos.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 4 页
字号:
The
.MONO WC&lpref.SortedVector<Type>
constructor creates an empty initialized
.MONO WC&lpref.SortedVector
object.
:SALSO.
:SAL typ='omtyp' ocls='WCExcept'.resize_required
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF cltype='WC&lpref.SortedVector<Type>' fmt='ctor' prot='public'.WC&lpref.SortedVector
:SNPL.
:SNPFLF                    .#include <wcvector.h>
:SNPFLF                    .public:
:SNPCD cd_idx='c'.WC&lpref.SortedVector( const WC&lpref.SortedVector & );
:eSNPL.
:SMTICS.
The
.MONO WC&lpref.SortedVector<Type>
constructor is the copy constructor for the
.MONO WC&lpref.SortedVector
class.
The new vector is created with the same length and
resize value as the passed vector.
All of the vector elements and exception trap states are copied.
:P.
If the new vector cannot be fully created, it will have length zero.  The
.MONO out_of_memory
.ix out_of_memory exception
exception is thrown if enabled in the vector being copied.
:RSLTS.
The
.MONO WC&lpref.SortedVector<Type>
constructor creates a
.MONO WC&lpref.SortedVector
object which is a copy of the passed vector.
:SALSO.
:SAL typ='fun'.operator~b=
:SAL typ='omtyp' ocls='WCExcept'.out_of_memory
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF cltype='WC&lpref.SortedVector<Type>' fmt='dtor' prot='public'.~~WC&lpref.SortedVector
:SNPL.
:SNPFLF                    .#include <wcvector.h>
:SNPFLF                    .public:
:SNPCD cd_idx='d'.virtual ~~WC&lpref.SortedVector();
:eSNPL.
:SMTICS.
The
.MONO WC&lpref.SortedVector<Type>
destructor is the destructor for the
.MONO WC&lpref.SortedVector
class.
If the vector is not length zero and the
.MONO not_empty
.ix not_empty exception
exception is enabled, the exception is thrown.
Otherwise, the vector entries are cleared using the
.MONO clear
member function.

.if &lpref. eq Ptr .do begin
The objects which the vector entries point to are not deleted unless the
.MONO clearAndDestroy
member function is explicitly called before the destructor is called.
.do end
The call to the
.MONO WC&lpref.SortedVector<Type>
destructor is inserted implicitly by the compiler at the point where the
.MONO WC&lpref.SortedVector
object goes out of scope.
:RSLTS.
The
.MONO WC&lpref.SortedVector<Type>
destructor destroys an
.MONO WC&lpref.SortedVector
object.
:SALSO.
:SAL typ='fun'.clear
.if &lpref. eq Ptr .do begin
:SAL typ='fun'.clearAndDestroy
.do end
:SAL typ='omtyp' ocls='WCExcept'.not_empty
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF cltype='WC&lpref.OrderedVector<Type>' fmt='mfun' prot='public'.append
:SNPL.
:SNPFLF                 .#include <wcvector.h>
:SNPFLF                 .public:
.if &lpref. eq Val .do begin
:SNPF index='append'        .int append( const &lparm. );
.do end
.el .do begin
:SNPF index='append'        .int append( &lparm. );
.do end
:eSNPL.
:SMTICS.
The &fn. appends the passed element to be the last element in the vector.

.if &lpref. eq Val .do begin
The data stored in the vector is a copy of the data passed as a parameter.
.do end

This member function has the same semantics as the
.MONO WC&lpref.OrderedVector::insert
member function.

:P.
This function is not provided by the
.MONO WC&lpref.SortedVector
class, since all elements must be inserted in sorted order by the
.MONO insert
member function.
:P.
Several different results can occur if the vector is not large enough for
the new element.
If the
.MONO resize_required
.ix resize_required exception
exception is enabled, the exception is thrown.
If the exception is not enabled, the append fails if the amount the vector
is to be grown (the second parameter to the constructor) is zero(0).
Otherwise, the vector is automatically grown by
the number of elements specified to the constructor, using the
.MONO resize
member function.
If
.MONO resize
fails, the element is not appended to the vector and the
.MONO out_of_memory
.ix out_of_memory exception
exception is thrown, if enabled.
:RSLTS.
The &fn. appends an element to the
.MONO WC&lpref.OrderedVector
object.  A TRUE (non-zero) value is returned if the append is successful.
If the append fails, a FALSE (zero) value is returned.
:SALSO.
:SAL typ='fun'.insert
:SAL typ='fun'.insertAt
:SAL typ='fun'.prepend
:SAL typ='omtyp' ocls='WCExcept'.out_of_memory
:SAL typ='omtyp' ocls='WCExcept'.resize_required
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.clear
:SNPL.
:SNPFLF                 .#include <wcvector.h>
:SNPFLF                 .public:
:SNPF index='clear'     .void clear();
:eSNPL.
:SMTICS.
The &fn. is used to clear the vector so that it contains no entries, and
is zero size.

.if &lpref. eq Val .do begin
Elements stored in the vector are destroyed using
.MONO Type's
destructor.
.do end
.el .do begin
Objects pointed to by the vector elements are not deleted.
.do end

The vector object is not destroyed and re-created by this function, so
the object destructor is not invoked.
:RSLTS.
The &fn. clears the vector to have zero length and no entries.
:SALSO.
:SAL typ='fun'.~~WC&lpref.OrderedVector
.if &lpref. eq Ptr .do begin
:SAL typ='fun'.clearAndDestroy
.do end
:SAL typ='fun'.operator~b=
:eSALSO.
:eLIBF.

.if &lpref. eq Ptr .do begin
:CMT.======================================================================
:LIBF fmt='mfun' cllong='yes' prot='public'.clearAndDestroy
:SNPL.
:SNPFLF                 .#include <wcvector.h>
:SNPFLF                 .public:
:SNPF index='clearAndDestroy'   .void clearAndDestroy();
:eSNPL.
:SMTICS.
The &fn. is used to clear the vector to have zero length and delete
the objects pointed to by the vector elements.
The vector object is not destroyed and re-created by this function, so
the vector object destructor is not invoked.
:RSLTS.
The &fn. clears the vector by deleting the objects pointed to by the
vector elements and makes the vector zero length.
:SALSO.
:SAL typ='fun'.clear
:eSALSO.
:eLIBF.
.do end
:CMT.======================================================================
:LIBF fmt='mfun' cllong='yes' prot='public'.contains
:SNPL.
:SNPFLF                 .#include <wcvector.h>
:SNPFLF                 .public:
:SNPF index='contains'  .int contains( const &lparm. ) const;
:eSNPL.
:SMTICS.
The &fn. is used to determine if a value is contained by a vector.

.if &lpref eq Ptr .do begin
Note that comparisons are done on the objects pointed to, not the pointers
themselves.
.do end

A linear search is used by the
.MONO WC&lpref.OrderedVector
class to find the value.  The
.MONO WC&lpref.SortedVector
class uses a binary search.
:RSLTS.
The &fn. returns a TRUE (non-zero) value if the element is found in the
vector.  A FALSE (zero) value is returned if the vector does not contain
the element.
:SALSO.
:SAL typ='fun'.index
:SAL typ='fun'.find
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.entries
:SNPL.
:SNPFLF                 .#include <wcvector.h>
:SNPFLF                 .public:
:SNPF index='entries'   .unsigned entries() const;
:eSNPL.
:SMTICS.
The &fn. is used to find the number of elements which are stored in
the vector.
:RSLTS.
The &fn. returns the number of elements in the vector.
:SALSO.
:SAL typ='fun'.isEmpty
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.find
:SNPL.
:SNPFLF                 .#include <wcvector.h>
:SNPFLF                 .public:
.if &lpref. eq Val .do begin
:SNPF index='find'          .int find( const Type &, Type & ) const;
.do end
.el .do begin
:SNPF index='find'          .Type * find( const Type * ) const;
.do end
:eSNPL.
:SMTICS.
The &fn. is used to find an element equivalent to

.if &lpref. eq Val .do begin
the first argument.
.do end
.el .do begin
the element passed.
Note that comparisons are done on the objects pointed to, not the pointers
themselves.
.do end

The
.MONO WC&lpref.OrderedVector
class uses a linear search to find the element, and the
.MONO WC&lpref.SortedVector
class uses a binary search.

:RSLTS.

.if &lpref. eq Val .do begin
If an equivalent element is found, a TRUE (non-zero) value is returned, and
the second parameter is assigned the first equivalent value.  A FALSE (zero)
value is returned and the second parameter is unchanged if the element is
not in the vector.
.do end
.el .do begin
A pointer to the first equivalent element is returned.  NULL(0) is returned
if the element is not in the vector.
.do end

:SALSO.
:SAL typ='fun'.contains
:SAL typ='fun'.first
:SAL typ='fun'.index
:SAL typ='fun'.last
:SAL typ='fun'.occurrencesOf
:SAL typ='fun'.remove
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.first
:SNPL.
:SNPFLF                 .#include <wcvector.h>
:SNPFLF                 .public:
:SNPF index='first'     .&lret first() const;
:eSNPL.
:SMTICS.
The &fn. returns the first element in the vector.  The element is not removed
from the vector.
:P.
If the vector is empty, one of two exceptions can be thrown.  The
.MONO empty_container
.ix empty_container exception
exception is thrown if it is enabled.  Otherwise, if the
.MONO index_range
.ix index_range exception
exception is enabled, it is thrown.
If neither exception is enabled, a first element of the vector is added

.if &lpref. eq Val .do begin
with a default value.
.do end
.el .do begin
with a NULL value.
.do end

:RSLTS.
The &fn. returns the value of the first element in the vector.
:SALSO.
:SAL typ='fun'.last
:SAL typ='fun'.removeFirst
:SAL typ='omtyp' ocls='WCExcept'.index_range
:SAL typ='omtyp' ocls='WCExcept'.resize_required
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.index
:SNPL.
:SNPFLF                 .#include <wcvector.h>
:SNPFLF                 .public:
:SNPF index='index'     .int index( const &lparm. ) const;
:eSNPL.
:SMTICS.
The &fn. is used find the index of the first element equivalent to the passed
element.

.if &lpref eq Ptr .do begin
Note that comparisons are done on the objects pointed to, not the pointers
themselves.
.do end

A linear search is used by the
.MONO WC&lpref.OrderedVector
class to find the element.  The
.MONO WC&lpref.SortedVector
class uses a binary search.
:RSLTS.
The &fn. returns the index of the first element equivalent to the parameter.
If the passed value is not contained in the vector, negative one (-1) is
returned.
:SALSO.
:SAL typ='fun'.contains
:SAL typ='fun'.find
:SAL typ='fun'.insertAt
:SAL typ='fun'.operator~b[]
:SAL typ='fun'.removeAt
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.insert
:SNPL.
:SNPFLF                 .#include <wcvector.h>
:SNPFLF                 .public:
.if &lpref. eq Val .do begin
:SNPF index='insert'        .int insert( const &lparm. );
.do end
.el .do begin
:SNPF index='insert'        .int insert( &lparm. );
.do end
:eSNPL.
:SMTICS.
The &fn. inserts the value into the vector.
.if &lpref. eq Val .do begin
The data stored in the vector is a copy of the data passed as a parameter.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -