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 "xml/xml_native_writer.h"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -72,11 +73,11 @@ static string WriteDoc(XMLDocument& doc, char *error, size_t error_sz) {
|
|||||||
std::string str = string(stream.CStr());
|
std::string str = string(stream.CStr());
|
||||||
|
|
||||||
// top level sections
|
// top level sections
|
||||||
auto sections = {"<actuator", "<asset", "<compiler", "<contact",
|
std::array<std::string, 17> sections = {
|
||||||
"<custom", "<default>", "<deformable", "<equality",
|
"<actuator", "<asset", "<compiler", "<contact", "<custom",
|
||||||
"<extension", "<keyframe", "<option", "<sensor",
|
"<default>", "<deformable", "<equality", "<extension", "<keyframe",
|
||||||
"<size", "<statistic", "<tendon", "<visual",
|
"<option", "<sensor", "<size", "<statistic", "<tendon",
|
||||||
"<worldbody"};
|
"<visual", "<worldbody"};
|
||||||
|
|
||||||
// position of newline before first section
|
// position of newline before first section
|
||||||
size_t first_pos = std::string::npos;
|
size_t first_pos = std::string::npos;
|
||||||
|
|||||||
Reference in New Issue
Block a user