| 47 | void Options::cleanup() { root() = Options{}; } |
| 48 | |
| 49 | Options Options::copy() const { |
| 50 | Options result; |
| 51 | |
| 52 | result.value = value; |
| 53 | result.attributes = attributes; |
| 54 | result.parent_instance = parent_instance; |
| 55 | result.full_name = full_name; |
| 56 | result.is_section = is_section; |
| 57 | result.value_used = value_used; |
| 58 | |
| 59 | // Recursively copy children |
| 60 | for (const auto& child_it : children) { |
| 61 | auto pair_it = result.children.emplace(child_it.first, child_it.second.copy()); |
| 62 | Options& child = pair_it.first->second; |
| 63 | child.parent_instance = &result; |
| 64 | } |
| 65 | return result; |
| 66 | } |
| 67 | |
| 68 | Options::Options(Options&& other) noexcept |
| 69 | : value(std::move(other.value)), attributes(std::move(other.attributes)), |
no outgoing calls