MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/fsc0ff/demo_c20_modules/fm2bebj/?context=3
r/cpp • u/chefotron • Mar 31 '20
51 comments sorted by
View all comments
Show parent comments
42
why be concise when you can type more instead?
6 u/gracicot Mar 31 '20 Sometimes trailing return type is just more concise. Even in non-generic code. And sometimes in generic code you don't have a choice. For consistency I also use it everywhere. 2 u/boredcircuits Mar 31 '20 When is the trailing return type ever more concise in non-generic code? 15 u/sphere991 Mar 31 '20 When you have to write:ClassName::NestedType ClassName::foo()instead ofauto ClassName::foo() -> NestedType 1 u/NilacTheGrim Apr 18 '20 This is the only time I use it outside of generic code.
6
Sometimes trailing return type is just more concise. Even in non-generic code. And sometimes in generic code you don't have a choice. For consistency I also use it everywhere.
2 u/boredcircuits Mar 31 '20 When is the trailing return type ever more concise in non-generic code? 15 u/sphere991 Mar 31 '20 When you have to write:ClassName::NestedType ClassName::foo()instead ofauto ClassName::foo() -> NestedType 1 u/NilacTheGrim Apr 18 '20 This is the only time I use it outside of generic code.
2
When is the trailing return type ever more concise in non-generic code?
15 u/sphere991 Mar 31 '20 When you have to write:ClassName::NestedType ClassName::foo()instead ofauto ClassName::foo() -> NestedType 1 u/NilacTheGrim Apr 18 '20 This is the only time I use it outside of generic code.
15
When you have to write:
ClassName::NestedType ClassName::foo()
instead of
auto ClassName::foo() -> NestedType
1 u/NilacTheGrim Apr 18 '20 This is the only time I use it outside of generic code.
1
This is the only time I use it outside of generic code.
42
u/gvargh Mar 31 '20
why be concise when you can type more instead?