J
Joe Van Dyk
Hi,
I have a class that looks like:
class ResultSet
Element* getNext();
// more
Now, I'd like to allow syntax similar to
while( i can grab stuff from the result set)
do something with the next element
What should ResultSet::getNext() return? A pointer to the next result and
NULL if there's no more results? A reference to the next element and
throw an exception if the user tries to getNext() when there's nothing
left? A smart pointer?
Btw, the user shouldn't be able to modify the returned Element at all.
Thanks,
Joe
I have a class that looks like:
class ResultSet
Element* getNext();
// more
Now, I'd like to allow syntax similar to
while( i can grab stuff from the result set)
do something with the next element
What should ResultSet::getNext() return? A pointer to the next result and
NULL if there's no more results? A reference to the next element and
throw an exception if the user tries to getNext() when there's nothing
left? A smart pointer?
Btw, the user shouldn't be able to modify the returned Element at all.
Thanks,
Joe