Dereferencing Operator and Exception Handling...
From: Barry Hynes (hynesb_at_mar.dfo-mpo.gc.ca)
Date: 09/29/04
- Next message: JonnyD: "Re: Seeking very user-friendly, drag-and-drop GUI design tool."
- Previous message: Simon Lewis: "Re: Why is C still being used instead of C++"
- Next in thread: Alwyn: "Re: Dereferencing Operator and Exception Handling..."
- Reply: Alwyn: "Re: Dereferencing Operator and Exception Handling..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Sep 2004 14:30:14 GMT
Good Day Folks,
struct Link_ { // struct, because Link is private
T value_;
Link_* next_;
Link_(const T&, Link_*); // link with the next element
};
class List{
...
class ListIterator{
public:
T& operator*() throw(domain_error);
const T& operator*() const throw(domain_error);
.....
private:
Link_* current_;
List& myList_;
};
.....
};
T& List::ListIterator::operator*(){
return current_->value_;
}
const T& List::ListIterator::operator*() const {
return current_->value_;
}
my question is how can you use exception handling on the two overloaded
dereferencing function?
i do not see anything i can test for...
if (current_->value_ == -1)
but value_ could actually be -1
not sure...maybe i am in the wrong ballpark ;)
anyhelp greatly appreciated
Barry
- Next message: JonnyD: "Re: Seeking very user-friendly, drag-and-drop GUI design tool."
- Previous message: Simon Lewis: "Re: Why is C still being used instead of C++"
- Next in thread: Alwyn: "Re: Dereferencing Operator and Exception Handling..."
- Reply: Alwyn: "Re: Dereferencing Operator and Exception Handling..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]