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() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -