c++ - How to find unique element count in string array? -


this question exact duplicate of:

for example, have list of towns. 20 of them in fact, in 20 town string array there 4 unique towns, randomly scattered in array , can repeat. how find unique town count?

use std::set, e.g.

std::set<std::string> myset(list_of_towns.begin(), list_of_towns.end()); 

assuming town names in std::vector called list_of_towns.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

Voice chat over bluetooth between Android & Python (pybluez) -

Integrate jquery-globalize into an ASP.NET Core MVC App -