Even if you will make sure that they are consequent (by allocating an array of them), your function calculating distance is wrong. It calculates distance in strings. That means you do not have any information about distance unless you know string size.
Example:
1 2 3 4 5 6 7
int main()
{
char* x = (char*)malloc(1000);
std::string* a = new (x) std::string();
std::string* b = new (x + 40) std::string();
std::cout << b - a;
}