#include "ArrayList.h"
template <typename T>
ArrayList<T>::ArrayList(): innerArray(new T[0]), len(0) {
// constructor stuff
}
template <typename T>
ArrayList<T>::~ArrayList() {
// destructor stuff
}
... on and on and on ...
このコードでは、クラス全体のすべてのメンバー関数の前にtemplate <typename T>
andを記述する必要があります。ArrayList<T>::
この繰り返し ( DRY )をなくす方法はありますか?
#include "ArrayList.h"
// do some magic
ArrayList(): innerArray(new T[0]), len(0) {
// constructor stuff
}
~ArrayList() {
// destructor stuff
}