Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of NSMutableArray in C++?

What is the C++ object which is the closest to Objective-C NSMutableArray?

like image 411
Regis_AG Avatar asked Jan 06 '12 17:01

Regis_AG


2 Answers

std::vector.

See http://www.cplusplus.com/reference/stl/vector/.

like image 142
Graham Perks Avatar answered Sep 22 '22 15:09

Graham Perks


NSMutableArray is a heterogeneous container, so: std::vector<std::any>

Before C++17, you could've used something like boost::any instead of std::any.

like image 35
Ferruccio Avatar answered Sep 23 '22 15:09

Ferruccio