I have my C++/CLI code using arrays like this (for example):
array<String^>^ GetColNames() {
vector<string> vec = impl->getColNames();
array<String^>^ arr = gcnew array<String^>(vec.size());
for (int i = 0; i < vec.size(); i++) {
arr[i] = strConvert(vec[i]);
}
return arr;
}
It's compiling fine until I add the library "array" to the project:
#include <array>
Then I don't know how to use the managed CLI array, because the compiler thinks that all the declared arrays are the std::array
.
Errors examples:
array<String^>^ arr
// ^ Error here: "too few arguments for class template "std::array""
gcnew array<String^>(vec.size())
// ^ Error: "Expected a type specifier"
How to solve this? I tried removing using namespace std
from that file, but it makes no difference. Should I remove that from every other C++ file on the project?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…