How do I get length of pointer string

How do I get length of pointer string??

I have something like this but not exactly

1
2
3
4
5
6
  map<int, string*> list;
  string len2[10] = { "ah", "am", "eh", "ha", "he", "ho", "ma", "no", "oh", "on" };
  string len8[7] = { "altrices", "articles", "backward", "charming", "cheaters", "cheating", "chetniks"};
  list[2] = len2;
  list[8] = len8;
  std::cout << len(list[8]) << std::endl; // <-- this is pseudocode to explain what I'm looking for 
Make it a map<int, vector<string>> instead. Then the number of items of length 2 is list[2].size()
And the reason you can't use raw arrays in this way is that the raw array decays into a pointer when used with your map (or any function for that matter), and loses its size information.
@dhayde: excellent reply
@Ganado: very useful information, I didn't see the problem with my logic until now

thanks both! :-)
Topic archived. No new replies allowed.