Function resize

Summary

#include <include/EASTL/bitvector.h>

(1) void resize(size_type n, value_type value)

(2) void resize(size_type n)

Function overload

Synopsis

#include <include/EASTL/bitvector.h>

void resize(size_type n, value_type value)

Description

No description yet.

Source

Lines 982-1010 in include/EASTL/bitvector.h. Line 274 in include/EASTL/bitvector.h.

template <typename Allocator, typename Element, typename Container>
void bitvector<Allocator, Element, Container>::resize(size_type n, value_type value)
{
    const size_type s = size();
    if(n < s)
        resize(n);
    // Fill up to the end of a word
    size_type newbits = n - s;
    while(mFreeBitCount && newbits)
    {
        push_back(value);
        --newbits;
    }
    // Fill the rest a word at a time
    if(newbits)
    {
        element_type element(0);
        if(value)
            element = ~element;
        const size_type words = (n + kBitCount - 1) / kBitCount;
        const size_type extra = words * kBitCount - n;
        mContainer.resize(words, element);
        mFreeBitCount = extra;
    }
}

Synopsis

#include <include/EASTL/bitvector.h>

void resize(size_type n)

Description

No description yet.

Source

Lines 971-979 in include/EASTL/bitvector.h. Line 275 in include/EASTL/bitvector.h.

template <typename Allocator, typename Element, typename Container>
void bitvector<Allocator, Element, Container>::resize(size_type n)
{
    const size_type wordCount = (n + kBitCount - 1) / kBitCount;
    const size_type extra     = (wordCount * kBitCount) - n;
    mContainer.resize(wordCount);
    mFreeBitCount = extra;
}





Add Discussion as Guest

Log in