lundi 2 novembre 2015

Which type to use for callable to std::bind

in a function I need to pass as argument a callable for std::bind. What is the correct type/template I should use?

void foo(std::function<void(KnownType)> function, WhatShouldThisBe target)
{
    std::bind(function, target);
}

The intended use would then be:

std::shared_ptr<SomeType> bar = std::make_shared<SomeType>();
foo(&SomeType::function, bar);

Aucun commentaire:

Enregistrer un commentaire