Getting started:
Part 1 (14:00)
Part 2 (14:25)
Part 3 (15:20)
Part 4 (15:30)
empty() const : returns true iff queue is empty front() : returns reference to front element (precond.: !empty()) front() const : returns const reference to front element (precond.: !empty()) pop() : removes front element (pre-cond.: !empty()) push(x) : add element x of type T at the endUse private inheritance from std::list
template ... class ... : private std::list<T> { using Base = std::list<T>; ... bool empty() const { return Base::empty(); } ... }Also make sure that your CC, AO, and destructor work (either by convincing yourself that the default implementation works or by writing test code), and check preconditions with assert. Also, test your code
Example:
template <typename T> class Foo { // don't allow T to be floating point type static_assert(...); ... }; cout << is_fp<double>::value << endl; // 1 cout << is_fp<float>::value << endl; // 1 cout << is_fp<int>::value << endl; // 0 Foo<int> f; // ok Foo<double> g; // failsIn file pp2.cpp implement class template is_fp<T> whose variable value is 1 if T is a floating point type, and 0 otherwise. Test it using the code above