0

This initialization of a std::array of strings fails:

const std::array<std::string, 1> str_array {"Text"};

Error message from gcc 5.1.1 is:

error: array must be initialized with a brace-enclosed initializer

Edit: This form of initialization also fails:

const std::array<std::string, 1> str_array = {"Text"};

Edit 2: Only this form works:

const std::array<std::string, 1> str_array {{"Text"}};
moonwalker
  • 1,157
  • 1
  • 18
  • 34

0 Answers0