Use std::array instead of std::vector for a constant array of strings.
PiperOrigin-RevId: 646826439 Change-Id: I7d9462109027ebb64cb52e3265dde87ca23f906f
This commit is contained in:
committed by
Copybara-Service
parent
8c380e7ba4
commit
13fce3e5b0
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "xml/xml_native_writer.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user