Skip to content

Commit

Permalink
Use std::array instead of std::vector for a constant array of strings.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 646826439
Change-Id: I7d9462109027ebb64cb52e3265dde87ca23f906f
  • Loading branch information
yuvaltassa authored and Copybara-Service committed Jun 26, 2024
1 parent 8c380e7 commit 13fce3e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/xml/xml_native_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "xml/xml_native_writer.h"

#include <array>
#include <cstddef>
#include <cstdio>
#include <string>
Expand Down Expand Up @@ -72,11 +73,11 @@ static string WriteDoc(XMLDocument& doc, char *error, size_t error_sz) {
std::string str = string(stream.CStr());

// top level sections
auto sections = {"<actuator", "<asset", "<compiler", "<contact",
"<custom", "<default>", "<deformable", "<equality",
"<extension", "<keyframe", "<option", "<sensor",
"<size", "<statistic", "<tendon", "<visual",
"<worldbody"};
std::array<std::string, 17> sections = {
"<actuator", "<asset", "<compiler", "<contact", "<custom",
"<default>", "<deformable", "<equality", "<extension", "<keyframe",
"<option", "<sensor", "<size", "<statistic", "<tendon",
"<visual", "<worldbody"};

// position of newline before first section
size_t first_pos = std::string::npos;
Expand Down

0 comments on commit 13fce3e

Please sign in to comment.