As a lazy developer, I like to use this trick to specify a default function:
template
boost::phoenix offers a complete functional toolbox, here 'arg1' is the ident to identity ;-)
#include template void index(X &x, Function f = Function()) { for (std::size_t i = 0; i < x.size(); ++i) { x[i] = f(i); } }