i'm trying to throw an exception on a class member like this:
#include <cstddef>
#include <stdexcept>
template <typename Object>
Object& ArrayList<Object>::operator[](size_t index)
{
if (index >= _size)
throw out_of_range("Index out of range");
return arr[index];
};
But I get the following error:
In file included from array_list_tests.cpp:4:
array_list.h: In member function 'Object& ArrayList<Object>::operator[](size_t)':
array_list.h:125:15: error: there are no arguments to 'out_of_range' that depend on a template parameter, so a declaration of 'out_of_range' must be available [-fpermissive]
throw out_of_range("Index out of range");
Why am I getting this error?