[sigc] dereference lambda has void return value



Hi,

I'm playing with sigc++ lambdas and I want to use the dereferencing operator on a lambda selector. It doesn't work with objects having operator*, somehow, the compiler can't deduce the return type.

There might be a simple explanation but I just don't see thru...


<code>
#include <tr1/memory>
#include <sigc++/adaptors/lambda/lambda.h>


class X
{
public:
  void do_sg() const
  {}
};


int main()
{
  std::tr1::shared_ptr<X> p(new X);
  sigc::group(&X::do_sg, *sigc::_1)(p);

  // error source can be reduced to the following statement:
  //(*sigc::_1)(p);

  return 0;
}
</code>


g++ compiler error:
/usr/include/sigc++-2.0/sigc++/adaptors/lambda/group.h:93: error: invalid use of void expression /usr/include/sigc++-2.0/sigc++/adaptors/lambda/group.h:93: error: return-statement with a value, in function returning 'void' /usr/include/sigc++-2.0/sigc++/adaptors/lambda/operator.h:489: error: return-statement with a value, in function returning 'void'




--
Klaus Triendl



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