jonhhy Posted December 2, 2016 at 10:51 PM Report #600990 Posted December 2, 2016 at 10:51 PM olá estava a ver está página: http://www.cplusplus.com/reference/unordered_set/unordered_set/insert/ que tem lá este exemplo: // unordered_set::insert #include <iostream> #include <string> #include <array> #include <unordered_set> int main () { std::unordered_set<std::string> myset = {"yellow","green","blue"}; std::array<std::string,2> myarray = {"black","white"}; std::string mystring = "red"; myset.insert (mystring); // copy insertion myset.insert (mystring+"dish"); // move insertion myset.insert (myarray.begin(), myarray.end()); // range insertion myset.insert ( {"purple","orange"} ); // initializer list insertion std::cout << "myset contains:"; for (const std::string& x: myset) std::cout << " " << x; std::cout << std::endl; return 0; } pesquisei e não tem grande coisa sobre este operator (falam em herança no operator conditional, no case de um switch): https://www.quora.com/What-is-the-meaning-of-in-C++ neste caso o que pensei no início foi ser algo do género de um for each, alguém me consegue especificar melhor?
Solution HappyHippyHippo Posted December 3, 2016 at 01:04 AM Solution Report #600992 Posted December 3, 2016 at 01:04 AM isso não é um operador é um novo formato de ciclo que apareceu no c++11 que serve para iterar um contentor, do género do std::for_each, mas mais simples de escrever IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now