Tag: exceptionless
Exceptionless Programming
November 28, 2012 00:00
I am a big fan of writing code that generates no runtime errors. This is an implementation of a function that takes the first element of an array.
template<typename T>
T first(std::vector<T> array)
{
if (array.size() == 0) { throw EmptyArrayException(); }
return array[0];
}
This is ...
Read post