c++ - Can I avoid returning a template return type of a function? -
i building priority que, , trying make template class. when pop, must return type t. there way return nothing or practice avoid crash if there nothing in que?
the expected behavior here throw exception. user should check queue being empty before trying pop. return null well, if type t never has value of null, otherwise ambiguous if being returned because error happened or because next value in queue null.
Comments
Post a Comment