Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

standard template libraries

I need to know how with STL I can use associative arrays, please provide code examples.
0
Buffon
Asked:
Buffon
  • 3
1 Solution
 
Jaime OlivaresCommented:
You have to use STL map object. Have a look to a previous discussion:
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20566432.html
0
 
BuffonAuthor Commented:
I saw this declaration:

typedef map<string,string> line;


as I understand it, it declares something like hashtable (value + key), so in declaration first "string" represents key or value?
0
 
Jaime OlivaresCommented:
>as I understand it, it declares something like hashtable (value + key), so in declaration first "string"
>represents key or value?
No, there is an non-standard hash_map<> collection class in some STL implementations.
Map usually have some internal implementation of tree (binary, balanced, etc....) but there is no a rule about this. Anyway, this is transparent to the user.
0
 
Jaime OlivaresCommented:
>so in declaration first "string" represents key or value?
Yes, first argument is the key
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now