2 Nov 2011 redi   » (Master)

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?

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!