Consider the code below which fails to compile:
#include <mutex>
#include <functional>
class t{
std::mutex m;
};
std::function<void(t test)> func = [](t test) {return;};
The following error is generated :
error: conversion from '<lambda(t)>' to non-scalar type 'std::function<void(t)>' requested
Can you explain to me why this conversion is not working?
PS : live example here : https://godbolt.org/z/7se8crf41