Неизвестная замена переменных

Сделал простой алгоритм сортирования (по четности и не четности чисел). Почему, первые два элемента заменяются на 5?

#include <iostream>
#include <vector>

#define _SMALL_BIT      1

template <class _Ty>
_CONSTEXPR20 void swap(_Ty& _First, _Ty& _Second) noexcept(true)
{
    _Ty temp = _STD move(_First);
    _First   = _STD move(_Second);
    _Second  = _STD move(_First);
}

int main(int argc, char* argv[])
{
    _STD vector<_STD size_t> vector{ 2, 4, 5, 1, 7, 9, 0, 0, 0 };

    for (_STD size_t index = 0; index < vector.size(); index++)
        for (_STD size_t index_next = 0; index_next < vector.size() - 1 - index; index_next++)
            if ((vector[index_next] & _SMALL_BIT) == 0 && (vector[index_next + 1] & _SMALL_BIT) == 1)
                swap(vector[index_next], vector[index_next + 1]);

    for (auto element : vector)
        _STD cout << element << " ";

    system("pause");

    return 0;
}

введите сюда описание изображения


Ответы (0 шт):