#include <functional>
using namespace std;
std::function<int (float)> discretize = [](float x)->int {return 0;};
template <typename DS>
auto discretizeAny(DS& ds) {
return ds.map(discretize);
}
template <typename T>
class MyDS {};
template <>
class MyDS<float> {
public:
MyDS<int> map(std::function<int (float)>) {
return MyDS<int>();
}
};
int main() {
MyDS<float> ds;
MyDS<int> ds1 = discretizeAny(ds);
return 0;
}
I2luY2x1ZGUgPGZ1bmN0aW9uYWw+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdGQ6OmZ1bmN0aW9uPGludCAoZmxvYXQpPiBkaXNjcmV0aXplID0gW10oZmxvYXQgeCktPmludCB7cmV0dXJuIDA7fTsKCnRlbXBsYXRlIDx0eXBlbmFtZSBEUz4KYXV0byBkaXNjcmV0aXplQW55KERTJiBkcykgewoJcmV0dXJuIGRzLm1hcChkaXNjcmV0aXplKTsKfQoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CmNsYXNzIE15RFMge307Cgp0ZW1wbGF0ZSA8PgpjbGFzcyBNeURTPGZsb2F0PiB7CnB1YmxpYzoKCU15RFM8aW50PiBtYXAoc3RkOjpmdW5jdGlvbjxpbnQgKGZsb2F0KT4pIHsKCQlyZXR1cm4gTXlEUzxpbnQ+KCk7Cgl9Cn07CgppbnQgbWFpbigpIHsKCU15RFM8ZmxvYXQ+IGRzOwoJTXlEUzxpbnQ+IGRzMSA9IGRpc2NyZXRpemVBbnkoZHMpOwoJcmV0dXJuIDA7Cn0=