mercredi 24 juillet 2019

c++: parse a string that contains an expression "access to the multidimensinal array"

How can one write a helper method that for a given string like foo[0][1][2][3] splits it into the array's name and collection (e.g. vector) of indices? In the example above it should produce foo and 0, 1, 2, 3 respectively.

Performance is not an issue here. I'm looking for the most elegant/short solution.

Aucun commentaire:

Enregistrer un commentaire