Fix allocation size vector
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
#include <cstddef>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@@ -12,7 +11,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
void Resize(std::size_t const newSize)
|
void Resize(std::size_t const newSize)
|
||||||
{
|
{
|
||||||
void * result = std::realloc(data, newSize);
|
void * result = std::realloc(data, newSize * sizeof(T));
|
||||||
if(result == nullptr)
|
if(result == nullptr)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Cannot allocate the requested size of memory.");
|
throw std::runtime_error("Cannot allocate the requested size of memory.");
|
||||||
|
|||||||
Reference in New Issue
Block a user