Category : vector

i am trying to make my own Vector and after i changed the move constructor i get Heap corruption detected: after normal block (#34115). This is the move constructor: template<typename T> inline Vector<T>::Vector(Vector&& other) : m_nrOfElements(std::exchange(other.m_nrOfElements, 0)), m_capacity(std::exchange(other.m_capacity, 0)), m_elements(std::exchange(other.m_elements, nullptr)) { } This is the code in its total: #pragma once #include <iostream> template ..

Read more

i am trying to make my own vector but i cant get it to work as i want. I get a error message on the Move-constructor it says: Exception thrown at 0x00007FF751A77ACC in auto-tests.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF. Here is the code: template<typename T> inline Vector<T>::Vector(Vector&& other) : m_nrOfElements(other.m_nrOfElements), m_capacity(other.m_capacity) { for (int ..

Read more