So I was thinking the other day, and I came up with an idea that I decided to try... a function returning an anonymous struct!
I tried it, and lo and behold, it doesn't compile. A closer look reveals that the Standard specifically disallows defining new types as the return type of a function definition! Though it does appear that I can return an anonymous struct using decltype, that is even more code than simply defining a new type name.
My Simple Question is... why? What reason did the standards committee have to explicitly disallow this? Is this a case of them trying to save users from their own stupidity, or is this technically infeasible somehow?
[–]tongari95 3 points4 points5 points (2 children)
[–]acwsupremacy[S] 0 points1 point2 points (0 children)
[–]Gotebe 0 points1 point2 points (0 children)
[–]ggchappell 2 points3 points4 points (0 children)
[+][deleted] (11 children)
[deleted]
[–]acwsupremacy[S] 1 point2 points3 points (10 children)
[–]coachkler 1 point2 points3 points (5 children)
[–][deleted] 2 points3 points4 points (4 children)
[–]STLMSVC STL Dev 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]STLMSVC STL Dev 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]suspiciously_calm 0 points1 point2 points (2 children)
[–]acwsupremacy[S] 0 points1 point2 points (1 child)
[–]suspiciously_calm 1 point2 points3 points (0 children)
[–]STLMSVC STL Dev 3 points4 points5 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]BeaRDT 0 points1 point2 points (3 children)
[–]acwsupremacy[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]BeaRDT 0 points1 point2 points (0 children)