- this->routers_ =
- new DragonflyRouter*[this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_];
-
- for (unsigned int i = 0; i < this->num_groups_; i++) {
- for (unsigned int j = 0; j < this->num_chassis_per_group_; j++) {
- for (unsigned int k = 0; k < this->num_blades_per_chassis_; k++) {
- DragonflyRouter* router = new DragonflyRouter(i, j, k);
- this->routers_[i * this->num_chassis_per_group_ * this->num_blades_per_chassis_ +
- j * this->num_blades_per_chassis_ + k] = router;
- }
- }
- }
+ this->routers_.reserve(this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_);
+ for (unsigned int i = 0; i < this->num_groups_; i++)
+ for (unsigned int j = 0; j < this->num_chassis_per_group_; j++)
+ for (unsigned int k = 0; k < this->num_blades_per_chassis_; k++)
+ this->routers_.emplace_back(i, j, k);