For an object, its destructor is called when it goes out of scope. Here's my program: #include &lt;iostream&gt; using namespace std;  class A {  public:   A() {}   ~A() { cout &lt;&lt; &quot;A's destructor called!&quot; &lt;&lt; endl; } };  class B {  public:   B() = delete;   B(int x_) {}   ~B() { cout &lt;&lt; &quot;B's destructor called!&quot; &lt;&lt; endl; } };  void func_a() { A a(); }  void func_b() { B b(1); }  int main() {   cout &lt;&lt; &quot;A&quot; &lt;&lt; endl;   func_a();   cout &lt;&lt; &quot;B&quot; &lt;&lt; endl;   func_b();   cout &lt;&lt; &quot;bye&quot; &lt;&lt; endl;   return 0; }  I thought either A's or B's destructor would be called. But the fact is only B's destructor called. I'm very confused. Is this because of the storage way of the class? Output: A B B's destructor called! bye
Is there any good reason that an empty set of round brackets (parentheses) isn't valid for calling the default constructor in C++?  MyObject  object;  // ok - default ctor MyObject  object(blah); // ok  MyObject  object();  // error   I seem to type "()" automatically everytime. Is there a good reason this isn't allowed?
Why does performance of a regular hard drive decrease over the duration of a benchmark while SSD doesn't? I use HD Tune to measure performance of the hard drive.  The tests typically take 2-3 minutes and the transfer rate of a regular hard drive decreases dramatically as the test comes to a close.    However, the SSD drive performance stays the same over (pic below) the life of the test.  This happens on all my computers.  Why is that? I would like to know how to create a physically correct mirror material in cycles. How can that be achieved as realistic as possible?  From :     Mirrors are manufactured by applying a reflective coating to a   suitable substrate ...      In modern times, the mirror substrate is shaped, polished and cleaned, and is then coated. Glass mirrors are most often coated with silver[20] or aluminium ...      In some applications, generally those that are cost-sensitive or that   require great durability, mirrors are made from a single, bulk   material such as polished metal ... In eevee, shadows are clipped by camera distance Documents with typical LaTeX errors I am giving a LaTeX course and have the idea to let the students find and solve problems within a few documents. Basically they shall learn how to create minimal examples and read error messages.  However, currently I have no document with 'typical' errors around.  If someone has such examples from him- or herself or within this forum I would like to have the code or link. It does not matter if its short or long. It should just be enough to let the students play with it for some minutes. How to do a secure erase on a Macbook Pro? I have a Macbook Pro with SSD and I would like to completely erase every single bits of data on it. How would I do that? On a PC, I would just run Darik's Boot And Nuke, but can I run it on a Mac too, or is there a better alternative? How do I take the limit as $n$ goes to $\infty$ of $\frac{\sqrt{n}}{\log(n)}$? How do take this limit:  $$ \lim_{n\to\infty} \frac{\sqrt{n}}{\log(n)}$$  I have a feeling that it is infinity, but I'm not sure how to prove it. Should I use L'Hopitals Rule? If I look through the microwave window I can see through, which means visible radiation can get out. We know also that there is a mesh on the microwave window which prevents microwave from coming out.  My question is how does this work? how come making stripes or mesh of metals can attenuate microwave radiation yet allow visible radiation?  Looks like an electrodynamics problem to me with periodic boundary conditions (because of the partitions on the microwave oven window). Is it discussed in any textbook? Volume form on $(n-1)$-sphere $S^{n-1}$ Let $\omega$ the (n-1) form on $\mathbb{R}^n$ $$\omega=\sum_{j=1}^{n}(-1)^{j-1}x_{j}dx_{1}\wedge\cdots\wedge \hat{dx_{j}}\wedge\cdots dx_{n}$$ Show that the restriction of $\omega$ to $S^{n-1}$ in precisely the volume for this sphere.  What I did was: $\omega$ never vanish on the sphere, because, defining $\sigma\in \Omega^{n-1}(S)$ for $$\sigma_{p}(v_{1},...,v_{n-1})=det(p,v_{1},...,v_{n-1})$$ and $i:S^{n-1}\rightarrow \mathbb{R}^{n}$ the inclusion function, then $\omega=i^{\ast}(\sigma)$ then $\omega\not=0$ and therfore is a volume form.   How proof that $\omega$ is the volume form?   The first thing that comes to mind is show that $\int_{S^{n-1}}\omega=Vol(S^{n-1})$ but I have serious problems with the definition, I think that is to much.   How see that $\omega$ is invariant on $\mathbb{R}^{n}$ under action of $O(n)$ How can I use awk to (sometimes) remove the first character of a column? A two way String hash function Proving that, $|f'(x)-f'(y)|\le k|x-y| \implies (f'(x))^2< 2 kf(x) $ Let $f:\Bbb R\to (0,\infty)$ be a differentiable function such that for some constant $k$ we have, $$|f'(x)-f'(y)|\le k|x-y|$$   for all $x,y \in\Bbb R.$ Then prove that, $$(f'(x))^2&lt;2 kf(x).$$   Due to lack of arguments I could not proof this inequality. But rather I proved that is true for the particular function,   $$f(x) =\cos^2(x)+1\implies f'(x) = -\sin(2x).$$ And we readily have,$$|\sin(2x)-\sin(2y)| = \left|\int_{2x}^{2y}\cos t dt\right|\le 2|x-y|$$ as well   $$(f'(x))^2 = 4 \sin^2 x\cos^2x &lt; 4(\cos^2x +1) = 4f(x).$$  It is also true for the function $x\mapsto \sin^2x +1.$   From these example I don't see how to prove the general case. Any hint will be welcome. Dynamically Determine Calling Context? We have various ways of invoking apex. Triggers, Inbound Webservices, @InvocableMethod,@RemoteAction and what not. Often we call some or other utility methods from these execution contexts. I have some generic utility method,that should behave differently from the context it is called?  I know about Trigger.isExecuting but it only tells if its running in trigger context or not.  I have a utility method that creates lead from Webservices, VF button click and via Lightning . Whenever we create a lead I want some special operations to be done via the source it was originated.(Its not just updating a simple field leadSource, I have some methods that creates some childs and update other records of other type) . I can achieve this by passing an extra parameter to utility method to tell about source, but i have then to edit hundred of other class that uses this utility method. If i could dynamically find out via which context this piece of code is running,then i would have to change only one class to satisfy my requirement.    Is there something in APEX that tells in what context the apex method was called? Is it possible to log back into a Pokemon Go account? So I had 20+ Pokemon on my account and today when I tapped on the app, it brought me back to the original screen when you first start playing. My friend who signed up tested using my username when she first started and my username was unavailable, meaning the account still exists. I don't have the password for the account, but I do have the email. So I wanted to know if it was possible to log back into an account? Calling a function of a module by using its name (a string) What does each SPECIAL stat in Fallout Shelter do? Besides its workplace uses, like Charisma in Living Quarters, Strength in Power Generators, Agility in Diners.   Do we know if Endurance increases HP in the Dwellers, or that strength helps in melee damage / survivability in the wastelands? And Perception? Is it possible to detect 32 bit vs 64 bit in a bash script? I am writing a bash script to deal with some installations in an automated way... I have the possibility of getting one such program in 32 or 64 bit binary... is it possible to detect the machine architecture from bash so I can select the correct binary?  This will be for Ubuntu machines. Determine Which of the following Sets is a Vector Space Determine which of the following sets is a vector space.  $V$ is the line $y=x$, in the $xy$-plane: $V =\{[x,y]: \; y=x\}$  $W$ is the union of the first and second quadrants in the $xy$-plane: $W=\{[x,y]: \; y\geq0\}$  $U$ is the line $y = x+1$ in the $xy$-plane: $U=\{[x,y]: \; y=x+1\}$    I know that the answer is that "$V$" is the only vector space. However how do I come up with a quick proof to show that $V $is a vector space and that the other $2$ aren't? How to prevent "Delhi Belly"? If $q$ is coprime to $a$ then $a\mid nq-1,\,$ so $q$ is invertible mod $a$ I think the following is true:  If $q$ is coprime to $a$ then $a\mid (nq-1)$ for some $n\in\mathbb Z$.  I have started to first reducing $n\in\mathbb Z$ to $n\in\{1,\ldots,a-1\}$ and then considering all the cases $q = ka + j$ for $j=1,2,3,\ldots,a-1$. I stopped at $j=3$ and found that this is kinda messy. Does anyone have an elegant proof for this (maybe using some results from number theory)?  [Note: question has been generalized from prime $q\nmid a$ to $\,q$ coprime to $a$] Why crontab scripts are not working? Often, crontab scripts are not executed on schedule or as expected. There are numerous reasons for that:   wrong crontab notation permissions problem environment variables   This community wiki aims to aggregate the top reasons for crontab scripts not being executed as expected. Write each reason in a separate answer.  Please include one reason per answer - details about why it's not executed - and fix(es) for that one reason.  Please write only cron-specific issues, e.g. commands that execute as expected from the shell but execute erroneously by cron.