Re: Postincrement causes match problem - bug or feature?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux