I am having some trouble wrapping my head around noexcept.
template <int SIZE>
int pop(int idx) noexcept(noexcept(SIZE > 0)) // this is what I dont understand
{
if (idx <= 0)
throw std::out_of_range("My array doesnt go that high");
return idx;
}
This is just a simple function, but you see how it only throws an exception when idx <= 0, I dont understand. So in my specification, noexcept(idx > 0), I am trying to tell the compilier this function ONLY throws no exceptions if idx > 0. Am I doing this right?
Any help is appreciated, I hope I am explaining it right. Just some simple explanation would be great.