mardi 27 juin 2017

CppCoreChekcer C-Style cast warning when using range based for loop on vector

Assume the following code:

std::vector<std::string> lines;
lines.push_back("line");
for (const auto& s : lines) {
    std::cout << s;
}

At the line of the for loop I get the following warning:

C26493 Don't use C-style casts that would perform a static_cast downcast, const_cast, or reinterpret_cast.

Can someone explain where this is coming from? Im using Visual Studio 2017 Community Edition Version 15.2.

Aucun commentaire:

Enregistrer un commentaire