November 1999
Intermediate to advanced
240 pages
5h 22m
English
Difficulty: 6
Historical note: The example used in this Item is adapted from one presented by Kevlin Henney and later analyzed by Jon Jagger in issues 12 and 20 of the British C++ magazine Overload. (British readers beware: The answer to this Item goes well beyond that presented in Overload #20. In fact, the efficiency optimization presented there won't work in the solution to this problem.)
What is the following solution doing, and why? Explain each constructor and operator. Does this design or code have any flaws?
template<typename T, size_t size>
class fixed_vector
{
public:
typedef T* iterator;
typedef const T* const_iterator;
fixed_vector() { }
template<typename O, size_t osize>
fixed_vector( ...Read now
Unlock full access