How to use string index in c++ arrays(like php)?
+2
A:
The closest thing is probably a std::map.
Check out the wikipedia page for details.
FigBug
2009-10-11 14:45:13
+1
A:
You need to use something like std::map to have an object with behavior similar to associative array.
Dmitriy Matveev
2009-10-11 14:46:29
+3
A:
They're called associative arrays (or dictionaries) and the allow you to use any type you want as a key, instead of just integers. They're natively supported in PHP, in C++ you should probably use std::map unless you're in .net, which has its own dictionary class
CrazyJugglerDrummer
2009-10-11 14:49:17
A:
This functionality called Map in general. If you already use Boost you can use their Maps, if not you must think twice :) Ok, if not Dimtry right - std::map is what you need.
Alexey Sviridov
2009-10-11 14:52:21