PPP2 [1], appendix E, shows the following code:
//--------------begin-------------------------------
template<class T> class Vector_ref {
vector<T*> v;
vector<T*> owned;
public:
Vector_ref() {}
Vector_ref(T* a, T* b = 0, T* c = 0, T* d = 0); // <---- *HERE*
~Vector_ref() { for (int i=0; i<owned.size(); ++i) delete owned[i]; }
void push_back(T& s) { v.push_back(&s); }
void push_back(T* p) { v.push_back(p); owned.push_back(p); }
T& operator[](int i) { return *v[i]; }
const T& operator[](int i) const { return *v[i]; }
int size() const { return v.size(); }
};
//----------------end-------------------------------
The problem is the line:
Vector_ref(T* a, T* b = 0, T* c = 0, T* d = 0);
This constructor doesn't have definition. Did he just forget to write that constructor or it is just a technique?
____________
[1]
http://www.stroustrup.com/Programming/