C++11 brainteaser
Here's a little program showing something that
std::bind
can do that lambdas can't.
#include <functional>
#include <string>
#include <iostream>
struct Polly
{
template<typename T, typename U>
auto operator()(T t, U u) const -> decltype(t + u)
{ return t + u; }
};
int main()
{
auto polly = std::bind(Polly(), std::placeholders::_1, "confusing");
std::cout << polly(4) << polly(std::string(" this is ")) << std::endl;
}
What will it print?