In C++, suppose I write a template function  template&lt;typename T&gt; void func(T obj){     obj.print(); }   But for some class, there might be not print() member function defined, which causes compilation errors. However, obj.print() may be not so important. Instead of add print() to the class, I prefer to make print() not called.  This may be a weird question. But just wondering if anyone ever saw such question.
Is it possible to write a template that changes behavior depending on if a certain member function is defined on a class?  Here's a simple example of what I would want to write:  template&lt;class T&gt; std::string optionalToString(T* obj) {     if (FUNCTION_EXISTS(T-&gt;toString))         return obj-&gt;toString();     else         return "toString not defined"; }   So, if class T has toString() defined, then it uses it; otherwise, it doesn't. The magical part that I don't know how to do is the "FUNCTION_EXISTS" part.
Let $K$ be any field. Is it true that:   If $f_1,\dots, f_k \in K[x_1,\dots,x_n]$ are polynomials of degree $1$, then $I=(f_1,\dots, f_k)$ is all $K[x_1,\dots,x_n]$, or, if it is a proper ideal, then is it prime? In particular, is it true that $K[x_1,\dots,x_n]/I$ is isomorphic to a polynomial ring (in the case that $I$ is proper and hence prime by the statement above)?   If they are true, how can i prove these statements in an elementary but rigorous way?  P.S.: Birth of my question: I found on my book that "affine varieties given by linear equations are irreducibile", so I translated (I don't know if I have made it right) this geometric statement into the analogous algebraic version. What should i use for better performance, nine-patch or drawable xml resource? What's the protocol for requesting a tag warning? On a particular site, RPG Stack Exchange, we've decided on our meta on a couple of tags that should have tag warnings, and on what those tag warnings should say. I am  on the site in question.  What should we do to get the tag warnings implemented? Do we do any/all of the following?:   start a [feature-request] on our meta for the tag warnings? raise a CM escalation? contact staff via the contact form? ping a staff member in the Teacher's Lounge? anything else? How do I install make? INT(5) vs SMALLINT(5): numbers in parenthesis after the numeric type In MySQL table definitions is there a different between INT(5) and SMALLINT(5)?  Or do they both represent the same size? Remove a part of a list of names I have some files and each files have distinct name but all of them have the same "-statement" at the end like this:  flower-statement.mp3 leave-statement.mp3  ball-statement.mp3 goal-statement.mp3   So I want to remove this: -statement  Is that possible? At least one prime between $\sqrt{n}$ and $n$? Prove that for all $n&gt;2$ there exists at least one prime $p$ such that $\sqrt{n}&lt;p&lt;n$ using elementary methods.  My try: If not, $\sum_{p&lt;\sqrt{n}} (\lfloor n/p \rfloor-\lfloor \sqrt{n}/p \rfloor) \geq n-\sqrt{n}$  then...? Let $\{E_n\}_{n\in\mathbb{N}}$ be a sequence of countable sets and let $S=E_1\times\cdots\times E_n\times\cdots $. Show $S$ is uncountable. Prove that the same statement holds if each $E_n=\{0,1\}$.  By the definition of Cartesian product of sets,   $$\displaystyle S=\Pi_{n\in\mathbb{N}} \{f\colon\mathbb{N}\rightarrow\cup_{n\in\mathbb{N}}E_n\mid\forall n, f(n)\in E_n\}$$  If $E_n=\{ 0,1\}$, then  $$\displaystyle S_{01}=\Pi_{n\in\mathbb{N}}\{0,1\}=E^{\mathbb{N}}$$, where $E=\{0,1\}$.  By a theorem, $\cup_{n\in\mathbb{N}} E_n$ is countable since the sequence is countable.  I'm not sure how to go on from here to show $S$ is uncountable. Can we say anything about the function $f$ that maps a countable $\mathbb{N}$ to another countable union of sequence of countable sets? Why does rubbing feet against sheets create a spark? Sometimes when I'm in bed at night, I rub my feet against the sheets and light is created. What exactly is going on?     I'm familiar with static electricity, and the triboelectric effect (creating a charge by rubbing 2 insulators together), and electrostatic discharge (releasing charge by touching a grounded conductor).     I believe that all of that is what is at work here, but I'm slightly confused since in other cases, the triboelectric effect and electrostatic discharge seem to occur as two separate steps, with different substances involved, and here, the two effects seem to be occurring simultaneously, with the same substances.     Can someone help me with a step-by-step explanation of the dynamics of what is going on? Lazy evaluation in C++ C++ does not have native support for lazy evaluation (as Haskell does).  I'm wondering if it is possible to implement lazy evaluation in C++ in a reasonable manner. If yes, how would you do it?  EDIT: I like Konrad Rudolph's answer.  I'm wondering if it's possible to implement it in a more generic fashion, for example by using a parametrized class lazy that essentially works for T the way matrix_add works for matrix.  Any operation on T would return lazy instead. The only problem is to store the arguments and operation code inside lazy itself. Can anyone see how to improve this? Remove vote UI elements beside own question and answer posts Currently, the system makes you think you can upvote/downvote your own question/answer but then you get notified that you can't. Why have the up/down vote buttons there then?   In general, if some operation is not allowed, then don't put UI for that up or make it disabled so it is apparently disabled - no post operation error panels please?  ps: hope this is not a dupe, but if so, just comment it and I will remove  (+a joke: a user notification panel message: I deleted this file. Is this a problem? Yes/No.) Express $1 + \frac {1}{2} \binom{n}{1} + \frac {1}{3} \binom{n}{2} + \dotsb + \frac{1}{n + 1}\binom{n}{n}$ in a simplifed form I need to express $$1 + \frac {1}{2} \binom{n}{1} + \frac {1}{3} \binom{n}{2} + \dotsb  + \frac{1}{n + 1}\binom{n}{n}$$ in a simplified form.  So I used the identity $$(1+x)^n=1 + \binom{n}{1}x + \binom{n}{2}x^2 + \dotsb   + \binom{n}{n}x^n$$ Now on integrating both sides and putting $x=1$.  I am getting $$\frac{2^{n+1}}{n+1}$$ is equal to the given expression.But the answer in my book is  $$\frac{2^{n+1}-1}{n+1}.$$ Where does that -1 term in the numerator come from? How to re-link missing blender files I have multiple characters linked to a blender file, but i moved the original character files and now blender is sating they're missing.  Is it possible to get blender to find the missing blender files like it finds missing image files so that i can preserve the previously made animation?  On a side note is there a way to also view a list of all the missing files? I know this proof is somewhat similar, or related to the Baire's Category Theorem but I can't seem to figure out how to do it.  The Baire Category theorem asserts that if X is a complete metric space or a locally compact Hausdorff space (my case), then the complement of a countable union of nowhere dense sets is always nonempty.  How can I use this on the proof? Gendry was born in the Crownlands and should therefore be referred to as Gendry Waters. However, he refers to himself as Gendry Rivers.   Did showrunners forget or is Gendry ignorant of the customs? Technically, NULL = NULL is False, by that logic no NULL is equal to any NULL and all NULLs are distinct. Shouldnt this imply that all NULLs are unique and a unique index should allow any number of NULLs? Inheriting from a UserControl in WPF I am fairly new to WPF and I am having a problem with inheriting from a user control.  I created a User Control and now I need to inherit from that control and add some more functionality.  Has anyone does this sort of thing before?  Any help would be greatly appreciated.  Thank you I often see statements in discussions about web displayed image quality that go something like this: "I only upload pictures at 72 dpi and 1200 pixels on the long edge, so if someone copies and prints the image it won't look as good as if it were 300 dpi."  What? Have I missed something here?  Does an image edited and saved/exported with 1200x800 pixels at 300 ppi look any different online than the same image saved/exported with 1200x800 pixels at 72 ppi? Other than the metadata regarding ppi, is there any difference in the two images at all? If so, what is the difference? If I tell my printer to print the images at 4R (4X6 inches) will there be any difference at all in how the printer creates a print from the 1200x800 @ 300 dpi image versus the 1200x800 @ 72 dpi image? Suppose that $f:[0,\infty)\rightarrow\mathbb{R}$ is continuous. Is it true that   $$\int_{0}^\infty|f(t)|dt&lt;\infty\Rightarrow \lim_{t\rightarrow\infty}f(t)=0?$$  If so can you provide a proof, otherwise a counter example. Thank you. SEO safe way to run beta of new site on seperate domain