--- tags: codebook --- # dvector ```cpp= template<typename T,int level> struct dvector{ using value_type = dvector<T, level-1>; vector<value_type> data; template<typename... Args> dvector(int n, Args... args){ data.assign(n, value_type(args...)); } auto& operator[](int index){ return data[index]; } }; template<typename T> struct dvector<T, 1>{ using value_type = T; vector<value_type> data; dvector(int n){ data.assign(n, 0); } auto& operator[](int index){ return data[index]; } }; ```