fix clazy non-pod-global-static warnings for strings

Viewed 2601

Clazy outputs warnings for non-pod-global-statics. I understand why this slows down code, but don't know what a better solution is? For instance, in this simple header file:

module1.hpp

#include <string>
#include <vector>

const std::vector<std::string> namesVec{"name1", "name2", "name3"};
static const std::string name{"name1"};

class Module1
{
  public:
    Module1();
    ~Module1();

    void func1();
};

There are two of these warnings, both for namesVec and name. What's the best way to avoid these warnings?

0 Answers
Related