Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
_
as "don't care" shorthand for the Default
contract group
Since now we might want to write flags afterwards, e.g., `<Group, flag1, flag2>`, programmers who want the default group `<Default, flag1, flag2>` might expect to be able to equivalently write `<_, flag1, flag2>`, so let's make that work Until now, programmers would just omit `<Default>` and that continues the work as the basic default, as before
- Loading branch information
479a345
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This special use of
_
, inassert<_>(true);
, bothers me due to an inconsistency.Any extra arguments are actually normal parameters, which is actually the purpose of this
_
in the first place.The inconsistency is evident after commit 94bea67 (which #927 seeks to generalize).
That would make
assert<()>(true);
be a more consistent spelling of the featureif the contract keywords are specified as
contract-keyword
: <contract_group: type = default, _...: type> = /*...*/
.That is, the first "template" argument to a contract keyword is defaulted to
default
.Note that CWG2450 has already made
std::map<int, {}>
be valid C++.I'm not suggesting to generalize this use of
_
, as #927 provides a better direction for generalization.