| 1418 | } |
| 1419 | |
| 1420 | Result<std::shared_ptr<StructType>> StructType::AddField( |
| 1421 | int i, const std::shared_ptr<Field>& field) const { |
| 1422 | if (i < 0 || i > this->num_fields()) { |
| 1423 | return Status::Invalid("Invalid column index to add field."); |
| 1424 | } |
| 1425 | return std::make_shared<StructType>(internal::AddVectorElement(children_, i, field)); |
| 1426 | } |
| 1427 | |
| 1428 | Result<std::shared_ptr<StructType>> StructType::RemoveField(int i) const { |
| 1429 | if (i < 0 || i >= this->num_fields()) { |