The postincrement makes a difference because the result of the
postincrement is a temporary value.
You can't pass a temporary value by non const reference.
IIUC, your results would be different if the first definition had const
in it as follows:
template <typename T>
int foo(T const& t1)
{
cerr << "Got in #1!\n";
return 0;
}
Andrew Bell wrote:
On Mon, Sep 29, 2008 at 10:51 AM, John Love-Jensen <eljay@xxxxxxxxx> wrote:
Hi Andrew,
The compiler cannot decide which of the two foo functions are more suitable,
since they are both equally suitable.
The real question is why the postincrement makes a difference. Can you explain?