The solution to homework 4 has been posted.
Some C++ compilers are broken on a friend statement like:
friend class C;Which is in the BiIterator template. If this is the case with your C++ compiler, the solution is to remove the friend statement, and put the constructor that is in the private section of the BiIterator class into the public section. Similarly, if the friend statement in the List
The Iterator.h file is online. This software is provided as is, which no expressed or implied warranty of any kind. That is, you can use it and change it to meet your needs.
Officially, there is no class today---it is a study day for final exams for six week summer courses. I will show up anyway, and talk about the List program, answer questions, and give more examples of using iterators. I will consider this the makeup class for the cancelled class on Wednesday of last week.
The solution to the midterm exam is now available.
struct Node {
Node* prev;
Node* next;
...
Node(Node* p = NULL) : prev(NULL), next(NULL) {
if (p) {
prev = p;
next = p->next;
p->next = this;
next->prev = this; // set previous pointer of next node to this node
}
}
...
};
Mid-term exam today. There have been some questions and answers about the exam, which may be of interest to you.
The TA will be holding office hours from 11:30-1:00 today to answer any last minute questions.
The Mid-term exam is scheduled for Tuesday, July 2nd, 1-2:30 in ENS 302. The TA will adminster the exam in my absence. Send any questions you have to me via email. I will post the questions and answers to the web page so everyone can benefit.
I pointed out all of them except one on the last slide (page 8 of 8) in the friend output operator function. Since the operator<< method is a friend of the IntStack class, it can access the private data, such as the array list; however, I left off the 's.' in the example on the notes:
ostream&
operator<< (ostream& os, const IntStack& s)
{
if (s.empty())
os << "Stack is empty" << endl;
else {
os << "Stack contains:" << endl;
for (int i = top; i > 0; i--)
os << list[i] << endl; // ERROR. list[i] of what object???
}
return os;
}
The code in the for loop to print the elements of the array list should be
written as follows:
for (int i = top; i > 0; i--) os << s.list[i] << endl;
The course newsgroup is now operational. I will post questions that I receieve (anonymously) and my answers, so that everyone can benefit. To access news.cc.utexas.edu, you need to be running a news reader from a campus network address. If you have access to some other Internet service provider, then I believe the newsgroup is publicly readable, so you should look for it using your local news server.
The PDF versions of the lecture notes are now available. You can set up the defaults in Netscape to launch Acrobat Reader automatically when downloading a file with a .pdf file extension.
The special "Unix Makefile Tutorial" class session will be held Friday, 21 June, in Taylor 2.106 from 1-2:30. This is not a regular class meeting and is not required, but will be useful to those of you using Unix for C++ development. I will provide a handout and an interactive tutorial on writing and using Makefiles. I will also cover using the GNU debugger (gdb) with g++ if time permits.