[feature request] requires clause in functions (concepts TS) #31514
Closed
Description
| Bugzilla Link | 32166 |
| Version | trunk |
| OS | All |
| CC | @CaseyCarter,@HazardyKnusperkeks,@mydeveloperday |
Extended Description
This code
template <bool IsConst>
struct A {
void prev()
requires BidirectionalIterator<iterator_t<IsConst>>() &&
BidirectionalIterator<iterator_t<IsConst>>() &&
BidirectionalIterator<iterator_t<IsConst>>()
{ --it_; }
};gets formatted into:
template <bool IsConst>
struct A {
void prev() requires BidirectionalIterator<iterator_t<IsConst>>() &&
BidirectionalIterator<iterator_t<IsConst>>() &&
BidirectionalIterator<iterator_t<IsConst>>() {
--it_;
}
};I don't see a reason why the options specified in #32165 shouldn't apply here as well.
this code:
template <class I>
requires
Iterator<I>()
// Pre: 0 <= n && [i,i+n)
constexpr void impl(I& i, difference_type_t<I> n)
noexcept(noexcept(++std::declval<I&>()))
{
STL2_EXPECT(0 <= n);
while (n != 0) {
--n;
++i;
}
}gets formatted into
template <class I>
requires Iterator<I>()
// Pre: 0 <= n && [i,i+n)
constexpr void impl(I& i, difference_type_t<I> n) noexcept(
noexcept(++std::declval<I&>())) {
STL2_EXPECT(0 <= n);
while (n != 0) {
--n;
++i;
}
}(Note how the constexpr keywords is not aligned with the template keyword).
Activity