exceptions

closed account (jGAShbRD)
template <typename T>
T & FastQueue<T>::front(){
if (number_of_elements == 0)
throw std::out_of_range;
else{
return storage.at(first);
}
}

is this how to throw an out_of_range?
i want to return a reference to first element of a queue and throw an out_of_range if the container is empty
It's a type, not a value, so throw std::out_of_range();.
Topic archived. No new replies allowed.