Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the parameter code of this method mean?

As the title says, TBitArray<> does not have an exact type, so does it mean that this method can accept any such as TBitArray<int32>, TBitArray<float>, ... as parameters?

FORCEINLINE bool HasAll(const TBitArray<>& Other) const
{
    FConstWordIterator ThisIterator(*this);
    FConstWordIterator OtherIterator(Other);

    while (ThisIterator || OtherIterator)
    {
        const uint32 A = ThisIterator ? ThisIterator.GetWord() : 0;
        const uint32 B = OtherIterator ? OtherIterator.GetWord() : 0;
        if ((A & B) != B)
        {
            return false;
        }

        ++ThisIterator;
        ++OtherIterator;
    }

    return true;
}

And what difference with this code

template<class T>
FORCEINLINE bool HasAll(const TBitArray<T>& Other) const
like image 945
Marsir Avatar asked Nov 17 '25 11:11

Marsir


1 Answers

TBitArray<> is a template class with all default template parameters. If it's TBitArray<int32> or TBitArray<float> depends on the template definition.

Here is its definition:

template<typename Allocator = FDefaultBitArrayAllocator>
class TBitArray;

So, it's neither int32 nor float, it's the default array allocator.

like image 73
273K Avatar answered Nov 20 '25 17:11

273K



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!