The second week of Generic Programming the lectures started to diverge from Object Oriented Programming, we finished off the first Collatz project, and started a new project called BFP PFDEP - Project File Dependencies. The path we are taking seems more focused on containers and algorithms.

Utexas

We covered the different flavors or iterators and itā€™s pretty hard to see the point or connect with the idea until one reads throught the cplusplus site.

std::priority_queue
...
The underlying container may be any of the standard container class templates or some other specifically designed container class. The container shall be accessible through random access iterators and support the following operations:
	empty()
	size()
	front()
	push_back()
	pop_back()
...
Support of random access iterators is required to keep a heap structure internally at all times. This is done automatically by the container adaptor by automatically calling the algorithm functions make_heap, push_heap and pop_heap when needed.

Going through the containers we can find the 5 main containers, Array, Vector, Forward_list, Deque, and List.

Then there are 3 default ā€œContainer Adaptorsā€ Stack, Queue, Priority Queue.

Queue
The standard container classes __deque__ and __list__ fulfill these requirements. By default, if no container class is specified for a particular queue class instantiation, the standard container deque is used.
template <class T, class Container = deque<T> > class stack;
template <class T, class Container = deque<T> > class queue;
template <class T, class Container = vector<T>,
  class Compare = less<typename Container::value_type> > class priority_queue;

Tip of the week

Team up! This semester I ended up taking the professors advice and found a partner for the project. Gosh ! It helped alot and made the projects so much more enjoyable and less stressful. If I was to work on both of the projects (Software Engineering & STL) alone I would have been stressing all weekend. At first I was little skeptical because my partner wasnā€™t very familiar with C++ and Iā€™m generally pretty pessimistic. But this Saturday we started working on the PFDEP project and were about 65% done, just needed to have it accepted by Sphere. Then my other project partner showed up and I had to go work on Software Engineering, so I said goodbyes and left to a computer a couple of rows down thinking weā€™ll just have to finish it Sunday. But my partner stayed there at the computer lab for about an hour and a half longer and then yelled out ā€œMarek dude itā€™s working!ā€