How to compare of std::function with lambda?
#include <iostream>
#include <functional>
using namespace std;
int main()
{
using Type = void( float, int );
std::function<Type> a;
auto callback = []( float d, int r )
{
cout << d << " " << r << endl;
};
static_assert( std::is_same< Type , decltype( callback ) >::value, "Callbacks should be same!" );
a(15.7f, 15);
}
Because in case of first parametr of lambda would be int
- code would compile with 1 warning. How to protect code?
Aucun commentaire:
Enregistrer un commentaire