Use vector<> and auto_ptr<> for dynamic memory allocation