#include <unordered_map>
#include <string>
using namespace std;
// this works
auto hf = [](string const& key)->size_t { return key[0]; };
unordered_map<string const, int, decltype(hf)> m (1, hf);
// this doesn't
template<class HASHER>
auto make_unordered_map(size_t bucketCount, HASHER const & hf2)
-> unordered_map<string const, int, decltype(hf2)>&&
{
return unordered_map<string const, int, decltype(hf2)>(bucketCount, hf2);
}
auto x = make_unordered_map(1, [](string const& key)->size_t { return key[0]; });
int main()
{
return 0;
}
I2luY2x1ZGUgPHVub3JkZXJlZF9tYXA+CiNpbmNsdWRlIDxzdHJpbmc+CiAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIAovLyB0aGlzIHdvcmtzCmF1dG8gaGYgPSBbXShzdHJpbmcgY29uc3QmIGtleSktPnNpemVfdCB7IHJldHVybiBrZXlbMF07IH07CnVub3JkZXJlZF9tYXA8c3RyaW5nIGNvbnN0LCBpbnQsIGRlY2x0eXBlKGhmKT4gbSAoMSwgaGYpOwogCi8vIHRoaXMgZG9lc24ndAp0ZW1wbGF0ZTxjbGFzcyBIQVNIRVI+IAphdXRvIG1ha2VfdW5vcmRlcmVkX21hcChzaXplX3QgYnVja2V0Q291bnQsIEhBU0hFUiBjb25zdCAmIGhmMikKICAtPiB1bm9yZGVyZWRfbWFwPHN0cmluZyBjb25zdCwgaW50LCBkZWNsdHlwZShoZjIpPiYmCnsKICAgIHJldHVybiB1bm9yZGVyZWRfbWFwPHN0cmluZyBjb25zdCwgaW50LCBkZWNsdHlwZShoZjIpPihidWNrZXRDb3VudCwgaGYyKTsKfQphdXRvIHggPSBtYWtlX3Vub3JkZXJlZF9tYXAoMSwgW10oc3RyaW5nIGNvbnN0JiBrZXkpLT5zaXplX3QgeyByZXR1cm4ga2V5WzBdOyB9KTsKIAppbnQgbWFpbigpCnsKICAgIHJldHVybiAwOwp9