What mechanism is involved, if when returning types, that are constructible from initializer lists, I don\'t specify the type I am returning, as in:
std::arr
There are no performance penalties involved. The return value is constructed equivalent to
std::array<int, 3> x = { 1, 2, 3 };
There is not even a single copy or move of an std::array instance involved.
The mechanism is just a constructor:
struct X {};
struct Y {
Y(X);
};
Y f() {
X x;
return x;
}