Algo::Unique

Eliminates all but the first element from every consecutive group of equivalent elements and returns past-the-end index of unique elements for the new logical end of the range.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Algo/Unique.h

Include

#include "Algo/Unique.h"

Syntax

namespace Algo
{
    template<typename RangeType>
    auto Algo::Unique
    (
        RangeType && Range
    )
}

Remarks

Eliminates all but the first element from every consecutive group of equivalent elements and returns past-the-end index of unique elements for the new logical end of the range.

Removing is done by shifting the elements in the range in such a way that elements to be erased are overwritten. Relative order of the elements that remain is preserved and the physical size of the range is unchanged. References to an element between the new logical end and the physical end of the range are still dereferenceable, but the elements themselves have unspecified values. A call to Unique_ is typically followed by a call to a container's RemoveAt_ method, which erases the unspecified values and reduces the physical size of the container to match its new logical size.

Elements are compared using operator== or given binary predicate. The behavior is undefined if it is not an equivalence relation.

See https://en.cppreference.com/w/cpp/algorithm/unique

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss