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

📄 concurrent_vector.h

📁 C语言库函数的原型,有用的拿去
💻 H
📖 第 1 页 / 共 5 页
字号:
    ///     <c>shrink_to_fit</c> is not concurrency-safe. You must ensure that no other threads are invoking methods
    ///     on the concurrent vector when you call this function.
    /// </remarks>
    /**/
    void shrink_to_fit();

    /// <summary>
    ///     Changes the size of the concurrent vector to the requested size, deleting or adding elements as
    ///     necessary. This method is not concurrency-safe.
    /// </summary>
    /// <param name="_N">
    ///     The new size of the concurrent vector.
    /// </param>
    /// <remarks>
    ///     If the size of the container is less than the requested size, elements are added to the vector until it reaches the
    ///     requested size. If the size of the container is larger than the requested size, the elements closest to the end of the container
    ///     are deleted until the container reaches the size <paramref name="_N"/>. If the present size of the container is the same as the requested
    ///     size, no action is taken.
    ///     <para><c>resize</c> is not concurrency safe.  You must ensure that no other threads are invoking methods
    ///     on the concurrent vector when you call this method.</para>
    /// </remarks>
    /**/
    void resize(size_type _N)
    {
        _Internal_resize( _N, sizeof(_Ty), max_size(), _Destroy_array, _Initialize_array, NULL);
    }

    /// <summary>
    ///     Changes the size of the concurrent vector to the requested size, deleting or adding elements as
    ///     necessary. This method is not concurrency-safe.
    /// </summary>
    /// <param name="_N">
    ///     The new size of the concurrent_vector.
    /// </param>
    /// <param name="_Val">
    ///     The value of new elements added to the vector if the new size is larger that the original size. If the value is omitted,
    ///     the new objects are assigned the default value for their type.
    /// </param>
    /// <remarks>
    ///     If the size of the container is less than the requested size, elements are added to the vector until it reaches the
    ///     requested size. If the size of the container is larger than the requested size, the elements closest to the end of the container
    ///     are deleted until the container reaches the size <paramref name="_N"/>. If the present size of the container is the same as the requested
    ///     size, no action is taken.
    ///     <para><c>resize</c> is not concurrency safe.  You must ensure that no other threads are invoking methods
    ///     on the concurrent vector when you call this method.</para>
    /// </remarks>
    /**/
    void resize(size_type _N, const _Ty& _Val)
    {
        _Internal_resize( _N, sizeof(_Ty), max_size(), _Destroy_array, _Initialize_array_by, static_cast<const void*>(&_Val) );
    }

    /// <summary>
    ///     Returns the maximum number of elements the concurrent vector can hold. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     The maximum number of elements the <c>concurrent_vector</c> object can hold.
    /// </returns>
    /**/
    size_type max_size() const
    {
        return (~size_type(0))/sizeof(_Ty);
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="iterator"/> or <typeparamref name="const_iterator"/> to the beginning of
    ///     the concurrent vector. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="iterator"/> or <typeparamref name="const_iterator"/> to the beginning of
    ///     the concurrent vector.
    /// </returns>
    /**/
    iterator begin()
    {
        return iterator(*this,0);
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="iterator"/> or <typeparamref name="const_iterator"/> to the end of
    ///     the concurrent vector. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="iterator"/> or <typeparamref name="const_iterator"/> to the end of
    ///     the concurrent vector.
    /// </returns>
    /**/
    iterator end()
    {
        return iterator(*this,size());
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="iterator"/> or <typeparamref name="const_iterator"/> to the beginning of
    ///     the concurrent vector. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="iterator"/> or <typeparamref name="const_iterator"/> to the beginning of
    ///     the concurrent vector.
    /// </returns>
    /**/
    const_iterator begin() const
    {
        return const_iterator(*this,0);
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="iterator"/> or <typeparamref name="const_iterator"/> to the end of
    ///     the concurrent vector. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="iterator"/> or <typeparamref name="const_iterator"/> to the end of
    ///     the concurrent vector.
    /// </returns>
    /**/
    const_iterator end() const
    {
        return const_iterator(*this,size());
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="reverse_iterator"/> or <typeparamref name="const_reverse_iterator"/> to the beginning of
    ///     the concurrent vector. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="reverse_iterator"/> or <typeparamref name="const_reverse_iterator"/> to the beginning of
    ///     the concurrent vector.
    /// </returns>
    /**/
    reverse_iterator rbegin()
    {
        return reverse_iterator(end());
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="reverse_iterator"/> or <typeparamref name="const_reverse_iterator"/> to the end of
    ///     the concurrent vector. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="reverse_iterator"/> or <typeparamref name="const_reverse_iterator"/> to the end of
    ///     the concurrent vector.
    /// </returns>
    /**/
    reverse_iterator rend()
    {
        return reverse_iterator(begin());
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="reverse_iterator"/> or <typeparamref name="const_reverse_iterator"/> to the beginning
    ///     the concurrent vector. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="reverse_iterator"/> or <typeparamref name="const_reverse_iterator"/> to the beginning of
    ///     the concurrent vector.
    /// </returns>
    /**/
    const_reverse_iterator rbegin() const
    {
        return const_reverse_iterator(end());
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="reverse_iterator"/> or <typeparamref name="const_reverse_iterator"/> to the end of
    ///     the concurrent vector. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="reverse_iterator"/> or <typeparamref name="const_reverse_iterator"/> to the end of
    ///     the concurrent vector.
    /// </returns>
    /**/
    const_reverse_iterator rend() const
    {
        return const_reverse_iterator(begin());
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="const_iterator"/> to the beginning of the concurrent vector.
    ///     This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="const_iterator"/> to the beginning of the concurrent vector.
    /// </returns>
    /**/
    const_iterator cbegin() const
    {
        return (((const _Myt *)this)->begin());
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="const_iterator"/> to the end of the concurrent vector.
    ///     This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="const_iterator"/> to the end of the concurrent vector.
    /// </returns>
    /**/
    const_iterator cend() const
    {
        return (((const _Myt *)this)->end());
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="const_reverse_iterator"/> to the beginning of the concurrent vector.
    ///     This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="const_reverse_iterator"/> to the beginning of the concurrent vector.
    /// </returns>
    /**/
    const_reverse_iterator crbegin() const
    {
        return (((const _Myt *)this)->rbegin());
    }

    /// <summary>
    ///     Returns an iterator of type <typeparamref name="const_reverse_iterator"/> to the end of the concurrent vector.
    ///     This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     An iterator of type <typeparamref name="const_reverse_iterator"/> to the end of the concurrent vector.
    /// </returns>
    /**/
    const_reverse_iterator crend() const
    {
        return (((const _Myt *)this)->rend());
    }

    /// <summary>
    ///     Returns a reference or a <c>const</c> reference to the first element in the concurrent vector. If the
    ///     concurrent vector is empty, the return value is undefined.  This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     A reference or a <c>const</c> reference to the first element in the concurrent vector.
    /// </returns>
    /**/
    reference front()
    {
        _ASSERTE( size()>0 );
        return static_cast<_Ty*>(_My_segment[0]._My_array)[0];
    }

    /// <summary>
    ///     Returns a reference or a <c>const</c> reference to the first element in the concurrent vector. If the
    ///     concurrent vector is empty, the return value is undefined. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     A reference or a <c>const</c> reference to the first element in the <c>concurrent_vector</c> object.
    /// </returns>
    /**/
    const_reference front() const
    {
        _ASSERTE( size()>0 );
        return static_cast<_Ty*>(_My_segment[0]._My_array)[0];
    }

    /// <summary>
    ///     Returns a reference or a <c>const</c> reference to the last element in the concurrent vector. If the
    ///     concurrent vector is empty, the return value is undefined. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     A reference or a <c>const</c> reference to the last element in the concurrent vector.
    /// </returns>
    /**/
    reference back()
    {
        _Size_type sz = size();
        _ASSERTE( sz > 0 );
        return _Internal_subscript( sz-1 );
    }

    /// <summary>
    ///     Returns a reference or a <c>const</c> reference to the last element in the concurrent_vector. If the
    ///     concurrent vector is empty, the return value is undefined. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     A reference or a <c>const</c> reference to the last element in the concurrent vector.
    /// </returns>
    /**/
    const_reference back() const
    {
        _Size_type sz = size();
        _ASSERTE( sz > 0 );
        return _Internal_subscript( sz-1 );
    }

    /// <summary>
    ///     Returns a copy of the allocator used to construct the concurrent vector. This method is concurrency-safe.
    /// </summary>
    /// <returns>
    ///     A copy of the allocator used to construct the <c>concurrent_vector</c> object.
    /// </returns>
    /**/
    allocator_type get_allocator() const
    {
        return this->_My_allocator;
    }

    /// <summary>
    ///     Erases the elements of the concurrent vector and assigns to it either <paramref name="_N"/> copies of
    ///     <paramref name="_Item"/>, or values specified by the iterator range [<paramref name="_Begin"/>, <paramref name="_End"/>).
    ///     This method is not concurrency-safe.
    /// </summary>
    /// <param name="_N">
    ///     The number of items to copy into the concurrent vector.
    /// </param>
    /// <param name="_Item">
    ///     Reference to a value used to fill the concurrent vector.
    /// </param>
    /// <remarks>
    ///     <c>assign</c> is not concurrency-safe. You must ensure that no other threads are invoking methods
    ///     on the concurrent vector when you call this method.
    /// </remarks>
    /**/
    void assign(size_type _N, const_reference _Item)
    {
        clear();
        _Internal_assign( _N, _Item );

⌨️ 快捷键说明

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