Liste des Groupes | Revenir à cl c |
Am 03.05.2024 um 08:45 schrieb Bonita Montero:Or do you mean sth. like this, where each function-object has its own
using namespace std;function<int ()> factory()
>
function<int ()> factory()
{
return []
{
static int count = 0;
return ++count;
};
}
{
static auto fn = []
{
static int count = 0;
return ++count;
};
return cref( fn );
}
Better this, it doesn't allocate external memory for the function<>
object.
Les messages affichés proviennent d'usenet.