Home / Programming / Programming Languages / C++ / How to implement an array with string index

How to implement an array with string index

Print Friendly

I had shown you how to implement an array with string based index in Python programming language in the previous post. In this post, I will explain the same problem but the programming language for the implementation is C++. The principle behind of the scene is to use map STL.

Overview of map STL

Map is among of advanced data types characterising as associative containers. It means that each element in such a container is a combination of key and value. This class is one of standard template libraries in C++.

The values can be accepted by arbitrary data types. Hence we can use the string as the indices of a map.

Associative Array

Associative Array




About Nguyen Vu Ngoc Tung

I love making new professional acquaintances. Don't hesitate to contact me via nguyenvungoctung@gmail.com if you want to talk about information technology, education, and research on complex networks analysis (i.e., metabolic networks analysis), data analysis, and applications of graph theory. Specialties: researching and proposing innovative business approaches to organizations, evaluating and consulting about usability engineering, training and employee development, web technologies, software architecture.