I've a C++20 console project in Visual Studio 19 with a Release configuration and a /MT flag. I am explicitly specifying namespaces for types in my projects. When I create
std::string Foo,
it creates std::string type. So far so good. However, when I create
std::vector <std::string> Bar,
it creates a std::vector<cv::String>
type instead, which leads to undesired consequences.
The cv namespace is comming from OpenCV4. Not only its from a different namespace, the type itself starts with capital 'S'.
I don't have any "using namespace" or any other "using"s anywhere in my projects.
Any ideas?
I've tried to use 'using namespace std' right before the line, just in case, but, as expected, it didn't work.
I've expected
std::vector <std::string> Bar
to create a
std::vector <std::string>
type, what am I doing wrong?
cv::String
and std::string
are actually the same thing.
From opencv2/core/cvstd.hpp
:
namespace cv {
typedef std::string String;
}
You can validate that with:
#include <type_traits>
static_assert(std::is_same_v<std::string, cv::String>, "");