Is it possible to write a function as:
void func(uint64_t val) {template <typename T>
void call_with(std::function<void(T)> f, T val) { f(val); }
int main() { auto print = [](int x) { std::cout << x; }; call_with(print, 42); }}
where a compile time error is generated if it's called with any other integer type than uint64_t, without modifying my #pragma warnings?
ie:
uint32_t x = 0;
func(x) {…} // Error!
func(uint64_t(x)) {…} // Succes!
func(1)? - Pete Becker