0

From clang-tidy I get for

struct Foo {
private:
  static constexpr char BAR[] = "\033[2J";
};

the warning

do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]

for BAR.

How can I declare with

#include <array>
struct Foo {
private:
  static constexpr std::array<char,7> BAR // = ???
};

Thanks

ge45mue
  • 677
  • 8
  • 23

1 Answers1

3

That's just:

std::array<char, 5> BAR{ '\033', '[', '2', 'J', 0 };
KamilCuk
  • 120,984
  • 8
  • 59
  • 111