Skip to content

Commit

Permalink
Use std::vector instead of std::array to make code more robust
Browse files Browse the repository at this point in the history
Avoids problem fixed in previous commit where the number of array
members was not correct.
  • Loading branch information
joto committed May 9, 2024
1 parent 4c70618 commit 17d879a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions src/command-line-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
#endif

#include <algorithm>
#include <array>
#include <cstdio>
#include <cstring>
#include <stdexcept>
#include <thread> // for number of threads
#include <vector>

static osmium::Box parse_bbox_param(std::string const &arg)
{
Expand Down Expand Up @@ -131,13 +131,10 @@ void print_version()

static void check_options_non_slim(CLI::App const &app)
{
std::array<std::string, 6> const slim_options = {
"--flat-nodes",
"--middle-schema",
"--middle-with-nodes",
"--middle-way-node-index-id-shift",
"--tablespace-slim-data",
"--tablespace-slim-index"};
std::vector<std::string> const slim_options = {
"--flat-nodes", "--middle-schema",
"--middle-with-nodes", "--middle-way-node-index-id-shift",
"--tablespace-slim-data", "--tablespace-slim-index"};

for (auto const &opt : slim_options) {
if (app.count(opt) > 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/flex-table-column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#include "util.hpp"

#include <algorithm>
#include <array>
#include <cctype>
#include <cstdlib>
#include <stdexcept>
#include <utility>
#include <vector>

struct column_type_lookup
{
Expand All @@ -27,7 +27,7 @@ struct column_type_lookup
char const *name() const noexcept { return m_name; }
};

static std::array<column_type_lookup, 25> const column_types = {
static std::vector<column_type_lookup> const column_types = {
{{"text", table_column_type::text},
{"boolean", table_column_type::boolean},
{"bool", table_column_type::boolean},
Expand Down

0 comments on commit 17d879a

Please sign in to comment.