pure function set_integer_int32 (V) result(res)
integer (int32), intent(in) :: V(:)
integer(int32), allocatable :: res(:)
integer(int32) :: sorted(size(V)), previous
type(buffer_int32_1D_t) :: buffer
integer :: i
sorted = V
call sort(sorted)
call buffer%init()
if (size(sorted) > 0) then
call buffer%push_back(sorted(1))
previous = sorted(1)
end if
do i = 2, size(sorted)
if (previous /= sorted(i)) then
call buffer%push_back(sorted(i))
previous = sorted(i)
end if
end do
call buffer%dump_reset(res)
end function set_integer_int32