but the vs compiler gives the error: error C2440: 'initializing': cannot convert from 'initializer list' to 'const char **'
is there any way to achieve this?
That's not an initializer that could ever work with an array of pointers to pointers to char. What do you expect g_arStr[0] (a pointer to pointer to char) to be pointing to? You're offering it {"one","two","three"}, but that's not a pointer to char, and your pointer-to-pointer-to-char can't point to it. (that's what the compiler said "cannot convert from 'initializer list' to 'const char **'")
You could use that iniitalizer with some other types, though:
vector of vectors of pointers:
1 2 3 4 5 6 7 8 9
#include <iostream>
#include <vector>
std::vector<std::vector<constchar*>> g_arStr = {{"one","two","three"},{"me","you","he","her"},{"male","female"}};
int main() {
for(constauto& r : g_arStr) {
for(constauto& p: r) std::cout << p << ' ';
std::cout << '\n';
}
}