Re: [sigc] =?windows-1252?q?Compile_error=3A_invalid_initialization_o?= =?windows-1252?q?f_non-const_reference_of_type_=91some=5Fslot=26=92_from_?= =?windows-1252?q?a_temporary_of_type_=2E=2E=2E?=



Peter Basista wrote:
>
> int bar (gslot & gs) { // The argument is a reference
>         std::cout << "Executing bar." << std::endl;
>         gs(0, 1.0, 'c', "hello");
>         return (0);
> }
> 
> [...]
>
>         bar(sigc::hide(sigc::mem_fun(ec, &ExampleClass::f))); 
> // <-- COMPILE ERROR

C++ does not allow anonymous objects to be passed where non-const references are expected.  Specifically, non-const references must be lvalues.

http://groups.google.com/group/comp.lang.c++/browse_thread/thread/814a071947c5b675/be95a615245cdbdf?#be95a615245cdbdf

- James


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