Quantcast
Channel: What are the type conversion rules for parameters and return values of lambdas? - Stack Overflow
Browsing all 5 articles
Browse latest View live

Answer by Jonathan Wakely for What are the type conversion rules for...

the conversion from a reference to a value looks strange to meWhy?Does this look strange too?int foo(int i) { return i; }void bar(const int& ir) { foo(ir); }This is exactly the same. A function...

View Article


Answer by Arunmu for What are the type conversion rules for parameters and...

Just adding to @ecatmur answer, g++/libstd++ just chose to ignore the return value of the callable, it's just as normal as one would do to ignore return value in regular code:static void_M_invoke(const...

View Article

Answer by Andrew for What are the type conversion rules for parameters and...

The assignment operator is defined to have the effect:function(std::forward<F>(f)).swap(*this);(14882:2011 20.8.11.2.1 par. 18)The constructor that this references,template <class F>...

View Article

Answer by ecatmur for What are the type conversion rules for parameters and...

You can assign a lambda to a function object of type std::function<R(ArgTypes...)> when the lambda is Lvalue-Callable for that signature. In turn, Lvalue-Callable is defined in terms of the...

View Article

What are the type conversion rules for parameters and return values of lambdas?

I was recently surprised by the fact that lambdas can be assigned to std::functions with slightly different signatures. Slightly different meaning that return values of the lambda might be ignored when...

View Article

Browsing all 5 articles
Browse latest View live