Not very good in cpp I tried to create a map taking as key a pair of two values and as value an instance of another class. The key class is a Point, having a attribut X and Y.  The problem I found when using a map is that it used operator&lt; to order the map and to find if two key are the same. But because I use a key with two values I cannot use it.  So I founded that unordered_map will prefer to use operator= for the verification, which I can use in my case.  But since then I couldn't create everything to make my class Point work as a key for my unordered_map.  I used as source :         My code :  I have put a clear version on a gist github :   I need to seperate everything between the .h and the .cpp. I can't only use a .cpp  Point.cpp :  bool operator==(const Point&amp; a, const Point&amp; b) {     return (a.X == b.X &amp;&amp; a.Y == b.Y); }  namespace std {     template&lt;&gt;     struct hash&lt;Point&gt;     {         std::size_t operator()(Point const&amp; p) const         {             std::size_t h1 = std::hash&lt;int&gt;{}(p.getX());             std::size_t h2 = std::hash&lt;int&gt;{}(p.getY());             return h1 ^ (h2 &lt;&lt; 1);         }     }; }   Definition of the map in my MapUser.h :      std::unordered_map&lt;Point, Biome*&gt;* map;   Initialization of the map in my MapUser.cpp :      this-&gt;map = new std::unordered_map&lt;Point, Biome*&gt;();     Logs :  ... Building 5 actions with 16 processes...   [1/5] Point.cpp   [2/5] Procedural_Terrain.cpp   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\INCLUDE\xhash(146): error C2064: le terme ne correspond pas ? une fonction qui prend 1 arguments   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\INCLUDE\xhash(172): note: voir les informations de r?f?rence sur le mod?le de variable 'const bool _Nothrow_hash&lt;std::hash&lt;Point&gt;,Point&gt;' en cours de compilation   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\INCLUDE\xhash(172): note: pendant la compilation de la fonction membre classe mod?le 'size_t std::_Uhash_compare&lt;_Kty,_Hasher,_Keyeq&gt;::operator ()&lt;Point&gt;(const _Keyty &amp;) noexcept(&lt;expr&gt;) const'           with           [               _Kty=Point,               _Hasher=std::hash&lt;Point&gt;,               _Keyeq=std::equal_to&lt;Point&gt;,               _Keyty=Point           ]   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\INCLUDE\unordered_map(404): note: pendant la compilation de la fonction membre classe mod?le 'Biome *&amp;std::unordered_map&lt;Point,Biome *,std::hash&lt;Point&gt;,std::equal_to&lt;Point&gt;,std::allocator&lt;std::pair&lt;const Point,Biome *&gt;&gt;&gt;::at(const Point &amp;)'   E:\Documents\GitHub\...\Source\...\Private\MapUser.cpp(51): note: voir la r?f?rence ? l'instanciation de la fonction mod?le 'Biome *&amp;std::unordered_map&lt;Point,Biome *,std::hash&lt;Point&gt;,std::equal_to&lt;Point&gt;,std::allocator&lt;std::pair&lt;const Point,Biome *&gt;&gt;&gt;::at(const Point &amp;)' en cours de compilation   E:\Documents\GitHub\...\Source\...\Private\MapUser.cpp(13): note: voir la r?f?rence ? l'instanciation classe mod?le 'std::unordered_map&lt;Point,Biome *,std::hash&lt;Point&gt;,std::equal_to&lt;Point&gt;,std::allocator&lt;std::pair&lt;const Point,Biome *&gt;&gt;&gt;' en cours de compilation   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\INCLUDE\xhash(145): error C2056: expression non conforme      I also tried this :      template&lt;&gt;     struct equal_to&lt;Point&gt;     {         bool operator()(const Point&amp; a, const Point&amp; b)         {             return (a.getX() == b.getX() &amp;&amp; a.getY() == b.getY());         }     };       this-&gt;map = new std::unordered_map&lt;Point, Biome*, std::hash&lt;Point&gt;, std::equal_to&lt;Point&gt; &gt;();   But I think in my case it just do the exact same thing.  Thanks for the ones that will take time to answer me, Have a nice day
Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)
cin>> not work with getline() I want to enter the following folder in the terminal:  Milano, Torino (Jan)-Compressed   How should I write the command cd to enter this directory?  Spaces and several other special characters like \, *, ), ( and ? cause problems when I try to use them in the command line or scripts, e.g.:    $ cd space dir bash: cd: space: No such file or directory  $ cat space file cat: space: No such file or directory cat: file: No such file or directory  $ cat ( bash: syntax error near unexpected token `newline'  $ echo content &gt;\ &gt; ^C  $ ls ? (  )  *  ?  \   How do I enter file or directory names that contain special characters in the terminal in general? Which livestock is the most efficient food source? I'm looking for a library in Python which will provide at and cron like functionality.  I'd quite like have a pure Python solution, rather than relying on tools installed on the box; this way I run on machines with no cron.  For those unfamiliar with cron: you can schedule tasks based upon an expression like:    0 2 * * 7 /usr/bin/run-backup # run the backups at 0200 on Every Sunday  0 9-17/2 * * 1-5 /usr/bin/purge-temps # run the purge temps command, every 2 hours between 9am and 5pm on Mondays to Fridays.   The cron time expression syntax is less important, but I would like to have something with this sort of flexibility.   If there isn't something that does this for me out-the-box, any suggestions for the building blocks to make something like this would be gratefully received.  Edit I'm not interested in launching processes, just "jobs" also written in Python - python functions. By necessity I think this would be a different thread, but not in a different process.  To this end, I'm looking for the expressivity of the cron time expression, but in Python.   Cron has been around for years, but I'm trying to be as portable as possible. I cannot rely on its presence. Remove a child with a specific attribute, in SimpleXML for PHP I have several identical elements with different attributes that I'm accessing with SimpleXML:  &lt;data&gt;     &lt;seg id="A1"/&gt;     &lt;seg id="A5"/&gt;     &lt;seg id="A12"/&gt;     &lt;seg id="A29"/&gt;     &lt;seg id="A30"/&gt; &lt;/data&gt;   I need to remove a specific seg element, with an id of "A12", how can I do this?  I've tried looping through the seg elements and unsetting the specific one, but this doesn't work, the elements remain.  foreach($doc-&gt;seg as $seg) {     if($seg['id'] == 'A12')     {         unset($seg);     } } I wonder whether it is possible to perform within R a clustering of data having mixed data variables. In other words I have a data set containing both numerical and categorical variables within and I'm finding the best way to cluster them. In SPSS I would use two - step cluster. I wonder whether in R can I find a similar techniques. I was told about poLCA package, but I'm not sure ... Edit Mode Transparent Objects Show that if $a \equiv b \pmod n$, $\gcd(a,n)=\gcd(b,n)$ My problem is how to somehow relate the the gcd and congruence. I know that $(a,b) = ax + by$. I also know that $a \equiv b \pmod n$ means $n\mid a-b$. Any hints?  Thanks! How do I remove Windows 7 from my dual boot system with Ubuntu? Rule of thumb for number of bootstrap samples I wonder if someone knows any general rules of thumb regarding the number of bootstrap samples one should use, based on characteristics of the data (number of observations, etc.) and/or the variables included? I have a dual boot laptop (Windows 10). I ran general updates and now my Ubuntu won't boot.   I ran in recovery mode and still it freezes in the same place.      Kernel panic – not syncing: Attempted to kill init! exit code=0x00007f00 Please tell me is there any fundamental difference between the two sentences:   Even today, people continue to use cheques.  Even today, people are continuing to use cheques.    I mean is there a difference as in time period (i.e when the action starts and when it ends). Or are the two sentence just the same and interchangeable? Should there always be a comma after "therefore","However" etc.? Prior to doing some benchmarking work how would one free up the memory (RAM) that the Linux Kernel is consuming for its buffers and cache?    Note that this is mostly useful for benchmarking. Emptying the buffers and cache reduces performance! If you're here because you thought that freeing buffers and cache was a positive thing, go and read . The short story: free memory is unused memory is wasted memory. I read this set of stories in the 80's.  What I recall is this:  A planet where the ruling caste was made up of humanoid women.  These women would, as almost pubescent girls, go out into the wilderness with only a spear and attempt to kill an animal in a life or death struggle.  When it happened, they would burst open a DNA packet in themselves that caused them to rapidly mature, their skin to become bronze colored, and give them some kinds of other "powers", I think over fire.  They were called "Bahronas", I think.  The population of this planet was primitive, but they were in contact with an advanced humanoid species, I think of actual homo-sapiens, who were there observing and advising them.  The advanced species wasn't allowed to intervene, just advise and watch.  The main character was a castaway boy, crash landed on their planet and stranded.  He became friendly with the ruling family of Bahronas and entered their confidence.  We find out through the course of the story that he's been genetically engineered and is not a normal boy.  At some point, the advanced species notices him and explains that he is a clone of a famous explorer and a spy, and they explain that they won't do anything in front of him.  The central part of the story is something of a blur, but, the final part of the story is told in a dramatically different style and shifts to a planet populated by catlike creatures who live in boughs of silk scarves, some of which sing.  THey are recording devices which play back the songs.  On this planet, there is another silk scarf, a white one, which doesn't play a song at all.  The cat creatures are greatly disturbed by it when they hear it's message, which they don't understand.  The narrator then goes on to say that it's a spoken word recording, made by the explorer which the boy was a clone of, explaining that he is captured and held hostage on the planet which makes the scarves, and forced to help make them (I think.) I have text file. Task - get first and last line from file after   $ cat file | grep -E "1|2|3|4" | commandtoprint  $ cat file 1 2 3 4 5   Need this without cat output (only 1 and 5).  ~$ cat file | tee &gt;(head -n 1) &gt;(wc -l) 1 2 3 4 5 5 1   Maybe awk and more shorter solution exist... Yes,  but there must be a canonical or most efficient or most concise way. I'll add answers I know of and see what percolates to the top.  To be clear, the question is how best to read the contents of a file into a string. One solution per answer. How does electron move around nucleus? I need to get a nice picture about how electron moves around nucleus? I find concept of probability and orbitals quite difficult to understand? How can I replace spaces with new lines on an input like:  /path/to/file /path/to/file2 /path/to/file3 /path/to/file4 /path/to/file5 etc...  To obtain the following:  /path/to/file /path/to/file2 /path/to/file3 /path/to/file4 /path/to/file5   Note  I'm posting this question to help other users, it was not easy to find a useful answer on UNIX SE until I started to type this question. After that I found the following:  Related question Your last flag was declined - no it wasn't I went to flag something, and in the flag dialog I got the message  "Your last flag was declined - please review it before flagging this post!"    That's all well and good, but when I went to review my flags, the statement is not accurate.  My last 5 flags were all marked 'helpful'.  The 6th down the list is marked 'declined', but that wasn't my last flag.  The message should probably be modified to correspond to the actual condition that triggers it.  Perhaps it should say     One of your flags was recently declined - please review it before flagging this post!   I'm going to guess that this message is triggered if, of all the flags of mine that have been handled by a moderator, the one that was most recently handled was declined. This isn't necessarily the last flag that I raised (the one I raised most recently), as moderators might handle them in a different order than I raised them, and it's not necessarily the flag at the top of the list.  Thus, calling it my "last" flag seems like it could cause confusion.  Yes, I realize this is extremely minor.