Здравствуйте, szag, Вы писали:
#include <string>
#include <vector>
#include <algorithm>
typedef std::string str;
typedef std::vector<str> StrContainer;
static const str s1 = "11";
static const str s2 = "22";
static const str s3 = "33";
static const str s4 = "44";
void f(char** p, int i)
{
for (int k = 0; k < i; ++k)
std::cout << p[k] << std::endl;
}
int main()
{
StrContainer vec;
vec.push_back(s1);
vec.push_back(s2);
vec.push_back(s3);
vec.push_back(s4);
std::vector<const char*> ptr_array(vec.size());
std::transform(vec.begin(), vec.end(), ptr_array.begin(), std::mem_fun_ref(&std::string::c_str));
f(const_cast<char**>(&ptr_array[0]), vec.size());
return 0;
}