My question is about "Template type" is used as return value.
Function template MakeRequest use template type as return value.
In the function template, there is a expression statement: InterfaceRequest<Interface> request;
[Q1]: How can create object "request" without function template instantiation? (MakeRequest's function parameter won't instantiate it.)
example::mojom::PingResponderRequest request = mojo::MakeRequest(&ping_responder);
[Q2]: "request" is already instantiated. the return value of "MakeRequest" is not instantiated. It's OK to assign the uninstantiated value to a instantiated value?
1. mojo::MakeRequest<foo>(&ping_responder)
2. First of all, the term is "initialized", not "instantiated". Only types can be instantiated or not. If an object exists, it's necessarily instantiated. There's no such thing as an uninstantiated object, in the same way that there are no four-sided triangles.
Second, what do you mean? The return value of MakeRequest() is an object. After its constructor returns, an object is always initialized. For example,
1 2 3 4
std::string f(){
std::string ret;
return ret;
}
f() doesn't return an uninitialized object, it returns an object constructed with the default constructor.
OK, Thanks. Due to the first question, I thought "InterfaceRequest<Interface> request" is not an completed object, or a function template without instantiated.
Base on your first answer, I understood the the second question.
Besides, I mixed the two conception "initialized" and "instantiated". Thanks for your correction.