Cleanups: Consistently comment enable_if_t
definitions
#3539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For C++17's parallel algorithms, where we separately declare and define many of them, we developed a convention where the declaration is
= 0
and the definition is/* = 0 */
. This is a reminder that while the default template argument can't be repeated, we haven't simply forgotten it:STL/stl/inc/algorithm
Lines 1124 to 1125 in 994f941
STL/stl/inc/execution
Lines 1119 to 1120 in 994f941
Thanks to Michael Grier for noticing that we've accumulated inconsistency elsewhere, with relics of an older convention where we'd name the template parameter in the definition
_Enabled
. That older convention was less clear and doesn't really provide new information (as we're already usingenable_if_t
)._Enabled = 0
to= 0
forcountr_one()
and_Popcount()
._Enabled
to/* = 0 */
forduration_cast()
,rotr()
,countl_zero()
, andswap()
for arrays.swap(_Ty&, _Ty&)
.= 0
and the definition is/* = 0 */
.int _Enabled = 0
and the definition isint _Enabled /* = 0 */
./* = 0 */
totuple
's ctors anduses_allocator_construction_args()
.After this cleanup, the only remaining uses of
_Enabled
in product code are in other contexts. I've audited all occurrences whereenable_if_t
appears in separate declarations and definitions, including through helper typedefs, so this cleanup should be fairly exhaustive.