Also duplicate of      Basically, what I am trying to do is :  struct A {     virtual ~A() {}     virtual int bar() = 0; };  struct B {     int bar() {return 1;} };  struct C {     int bar() {return 2;} };   struct D {     template &lt;class T&gt;     static int foo() {         T a;         return a.bar();     } };   template&lt;class T, class U&gt; int callFoo() {     return T::foo&lt;U&gt; (); ///error: expected primary-expression before '&gt;' token }   int main(int argc, char** argv) {         std::cout &lt;&lt; D::foo&lt;B&gt;() &lt;&lt; std::endl; //This works of course         std::cout &lt;&lt; D::foo&lt;C&gt;() &lt;&lt; std::endl; //This works of course         std::cout &lt;&lt; callFoo&lt;D,B&gt;() &lt;&lt; std::endl;         std::cout &lt;&lt; callFoo&lt;D,C&gt;() &lt;&lt; std::endl;     }   How can I call a templated static method of a class which is parameter template of my function?
In templates, where and why do I have to put typename and template on dependent names? What exactly are dependent names anyway?    I have the following code:  template &lt;typename T, typename Tail&gt; // Tail will be a UnionNode too. struct UnionNode : public Tail {     // ...     template&lt;typename U&gt; struct inUnion {         // Q: where to add typename/template here?         typedef Tail::inUnion&lt;U&gt; dummy;      };     template&lt; &gt; struct inUnion&lt;T&gt; {     }; }; template &lt;typename T&gt; // For the last node Tn. struct UnionNode&lt;T, void&gt; {     // ...     template&lt;typename U&gt; struct inUnion {         char fail[ -2 + (sizeof(U)%2) ]; // Cannot be instantiated for any U     };     template&lt; &gt; struct inUnion&lt;T&gt; {     }; };   The problem I have is in the typedef Tail::inUnion&lt;U&gt; dummy line. I'm fairly certain that inUnion is a dependent name, and VC++ is quite right in choking on it. I also know that I should be able to add template somewhere to tell the compiler that inUnion is a template-id. But where exactly? And should it then assume that inUnion is a class template, i.e. inUnion&lt;U&gt; names a type and not a function?
Which profile details does an account merge preserve? When one has to merge two accounts, they're prompted by something like this with input fields for each account link:     Account 1:  Account 1 link.       Account 2:  Account 2 link.    When the merge completes, which account details are preserved, like the display name, or the profile description? Account 1, or account 2? Why are our planets in the solar system all on the same disc/plane/layer? Where can I get flight info for a flight a month ago for an insurance claim? Flight stat sites will only show a weeks worth of data. How to run find -exec? I'd like to find the files in the current directory that contain the text "chrome".  $ find . -exec grep chrome find: missing argument to `-exec'   What am I doing wrong? Running Yosemite 10.0 with a clean erase and install, when I reboot, all my launchpad apps are totally disorganised, folders and un-official apps disappears...  After reorganizing the layout twice, I don't want to keep sorting my launchpad every time I restart my Mac. Is black a color or absence of color? Let $\{s_n\}$ and $\{t_n\}$ be sequences.  I've noticed this inequality in a few analysis textbooks that I have come across, so I've started to think this can't be a typo:  $\limsup\limits_{n \rightarrow \infty} s_n + \liminf\limits_{n \rightarrow \infty} t_n \leq \limsup\limits_{n \rightarrow \infty} (s_n + t_n) \leq \limsup\limits_{n \rightarrow \infty} s_n + \limsup\limits_{n \rightarrow \infty} t_n$.  I understand the right two-thirds of the equation, and can prove it.  I'm stuck on the far-left third.  I don't understand how that is true. had declared the sentence below as follow: 1) STAR TURN, 2) BEST LINES.      I wish Bernard Cribbins was my grandad. Perhaps he would be willing to   adopt?     Rattigan: “If only that was possible.” The Doctor: “If only that were   possible. Conditional clause.”    Is 'was' after 'I wish', 'if only' and 'if' (in conditional clauses) colloquial?  Does it be used in formal speech and writing? I'm trying to connect 32 I²C "root of trust"  devices.    I'm thinking about a good way that does that, I mean what kind of communication should I use? A digital multiplexer that selects a device? but based on what? switching on the VDD source? but that needs reinitialization of the device and that takes time. I was making a scene in blender and I wanted to change the texture from "Material_1" to "Material_2". It lets me change it but when I go to rendered view the part looks the same. can someone please help me How to redirect output of an entire shell script within the script itself? Is it possible to redirect all of the output of a Bourne shell script to somewhere, but with shell commands inside the script itself? Redirecting the output of a single command is easy, but I want something more like this: #!/bin/sh if [ ! -t 0 ]; then     # redirect all of my output to a file here fi  # rest of script...  Meaning: if the script is run non-interactively (for example, cron), save off the output of everything to a file.  If run interactively from a shell, let the output go to stdout as usual. I want to do this for a script normally run by the FreeBSD periodic utility.  It's part of the daily run, which I don't normally care to see every day in email, so I don't have it sent.  However, if something inside this one particular script fails, that's important to me and I'd like to be able to capture and email the output of this one part of the daily jobs. Update: Joshua's answer is spot-on, but I also wanted to save and restore stdout and stderr around the entire script, which is done like this: # save stdout and stderr to file  # descriptors 3 and 4,  # then redirect them to &quot;foo&quot; exec 3&gt;&amp;1 4&gt;&amp;2 &gt;foo 2&gt;&amp;1  # ...  # restore stdout and stderr exec 1&gt;&amp;3 2&gt;&amp;4 How to find event listeners on a DOM node when debugging or from the JavaScript code? I have a page where some event listeners are attached to input boxes and select boxes. Is there a way to find out which event listeners are observing a particular DOM node and for what event?  Events are attached using:    Event.observe; DOM's addEventListener; As element attribute element.onclick. The version of python2 on my Ubuntu 14.04 machine is Python 2.7.6. How can I upgrade it to the the latest version of Python 2.X? The latest is currently 2.7.11.  I have tried apt-get update/upgrade, but the repository doesn't seem to have the latest version. How to start a new Linux distro? Why is AES considered to be secure? The security of RSA is based on the integer factorization problem, which is a very well defined and understood mathematical problem. This problem must be solved in order to fundamentally break RSA.   What about AES (and others based on the same idea)? Why is it difficult to break? Is there any mathematical principle that ensures its security? Proper capitalization of commonly used acronyms and initialisms How to adopt SD card as internal storage on Samsung devices? How to know if Google Sheets IMPORTDATA, IMPORTFEED, IMPORTHTML or IMPORTXML functions are able to get data from a resource hosted on a website? Google Sheets has several import functions   IMPORTDATA IMPORTFEED IMPORTHTML IMPORTXML   Sometimes the above functions returns errors like #N/A Imported content is empty and would like to be sure that there isn't a problem with the resource content to be imported.  How do I know if these functions are able to get the content that I looking to import?  I know that there also exist IMPORTRANGE but that function only is able to import content from Google Sheets spreadsheets How to convert Strings to and from UTF8 byte arrays in Java In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions? Jet stream of water I would like to simulate a stream of water like the one in the picture, but I don't know how to simulate the fast-moving, white water. Should I use particles to simulate foam or is it much better to concentrate in the material properties? Thanks