Template argument deduction fails when using braced initializer list
问题 I'm trying to use template argument deduction in the 'perpendicular()' function: #include <iostream> template <typename component = double> struct offset { component x; component y; }; template <typename component> offset(component x, component y) -> offset<component>; template <typename component> offset<component> perpendicular(offset<component> const &o) { return offset{o.y, -o.x}; } template <typename component> std::ostream &operator<<(std::ostream &s, offset<component> const &o) {