Jump to content

Operador ":"


jonhhy
Go to solution Solved by HappyHippyHippo,

Recommended Posts

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?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.