Can a vector class in C++ be used like a Dictionary class in C#? -
can vector class in c++ used dictionary class in c#? can have vector class store classes of same type. member of class can regarded key , remaining members can thought of data.
no, vector class in general won't stay sorted when add members. means can't efficiently find items in it, need linear scan.
use std::unordered_map
key-value container offer o(1) key lookup.
Comments
Post a Comment