I define a method like so:

template &lt;class ArgT&gt;
void foo(ArgT arg, ::boost::function&lt; void(ArgT) &gt; func)
{
    func(arg);
}


and use it like this --for instance--:

foo(2, [](int i) -&gt; void { cout &lt;&lt; i &lt;&lt; endl; });


Why can't the compiler deduce the type since it's definitely an int?

I get 'void foo(ArgT,boost::function&lt;void(ArgT)&gt;)' : could not deduce template argument for 'boost::function&lt;void(ArgT)&gt;' from 'anonymous-namespace'::&lt;lambda0&gt;'.


Question: Do volcano blast changes earth's course?
Answer: Shoot out a pea attached with a spring to the big lead ball. Nothing will change for the course of earth as the (minimal shifted) centre of mass of the whole system keeps it initial course it always had.

If the force is so great that the spring snaps and the pea does get detached, the c.m. wouldn't change either as the recoil moment would push it back. Earth will have a wobble for a while, being dampened by releasing heat. 

Entropy is rising so thermodynamically sound.