C++11 factory pattern with lambdas
First of all, I will assume there is something like template &lt;typename T&gt; somewhere in your code. Otherwise, I doubt it would compile.

There is something you could do to improve your program: use emplace_back instead of push_back with an object construction. That way, objects will be created right in the collection (list, vector, etc...). By the way, I'll also assume that markers is a standard collection.

auto callback_factory = 
    [&amp;] (IPMarkerType start, IPMarkerType stop) -&gt; std::function&lt;void(IPNode&lt;T&gt;&amp;)&gt;
{
    return [&amp;,start,stop](IPNode&lt;T&gt; &amp; node){ 
        markers.emplace_back(node.ip, start);  
        markers.emplace_back(node.ip.network_ones(node.prefix), stop);
    };
};


And, yeah, something still smells: I really wonder how and/or where you declared markers. If it's a global variable, then I think the template parameter may cause some problems.