Template Function otyca::unique_elements

Function Documentation

template<typename T>
std::vector<T> otyca::unique_elements(const std::vector<T> &vec)

Removes duplicate elements from a vector while maintaining order.

Template Parameters:

T – Type of elements in the vector.

Parameters:

vec – Input vector with possible duplicates.

Returns:

std::vector<T> A new vector without duplicates.