Yet another FizzBuzz
I'd be inclined to make a simple fixed array instead of a std::vector for funcs:

const std::function&lt;void(int i)&gt; funcs[] {
    [](int i) { std::cout &lt;&lt; i &lt;&lt; "\n"; },
    [](int ) { std::cout &lt;&lt; "fizz\n";  },
    [](int ) { std::cout &lt;&lt; "buzz\n";  },
    [](int ) { std::cout &lt;&lt; "fizzbuzz\n"; }
};


This is useful because it eliminates the overhead of memory allocations for a std::vector and the calls for constructor and destructor.  As an embedded systems guy, I tend to think about whether code can be in ROM rather than RAM, and whether work can be done at compile-time rather than run-time.

Note, too that I've omitted the variable name for the last three lambdas.  There's no real difference except that it prevents the compiler from generating a warning about "unused parameter i" in those three lines.

Also, I think you're overthinking the lambda.  The test lambda isn't really necessary at all since you can call it like this:

funcs[ (i % 3 == 0) + 2 * (i % 5 == 0) ](i);


So (without xrange.h, although one could use that also) it would look like this:

#include &lt;iostream&gt;
#include &lt;functional&gt;

int main() {
    const std::function&lt;void(int i)&gt; funcs[] {
        [](int i) { std::cout &lt;&lt; i &lt;&lt; "\n"; },
        [](int ) { std::cout &lt;&lt; "fizz\n";  },
        [](int ) { std::cout &lt;&lt; "buzz\n";  },
        [](int ) { std::cout &lt;&lt; "fizzbuzz\n"; }
    };

    for (int i=1; i &lt;= 100; ++i)
        funcs[ (i % 3 == 0) + 2 * (i % 5 == 0) ](i);
}