c++ - C++11 Avoiding Redundant Return Type in specific Situation -
ok, has looked @ this. i've recreated exact scenario easy viewing @ link below, i'll comment out original text had wasn't clear. http://cpp.sh/5lp4l
in comment section show calling make_some(32, std::string{"hi"}) without specifying data type declaration call. realize seems insane , way above expected use case, automatically inferring composite type (inferring wanted data, based on int/string) based on arguments wasn't necessary, or idea.
the compiler right. there's no relation given between t
, args
. hence, cannot determine queryresult<t>
means.
what apparently expect return type of somefn
forces t
int, int
. that's not possible 2 reasons: t
denotes single type, , there's no mechanism return
statement somehow affects template instantiation of make_some
.
Comments
Post a Comment