Skip to content

Commit 036e84f

Browse files
committed
LWG4383 constant_wrapper's pseudo-mutators are underconstrained
1 parent 89dd8db commit 036e84f

File tree

1 file changed

+25
-41
lines changed

1 file changed

+25
-41
lines changed

source/meta.tex

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -778,62 +778,47 @@
778778
// pseudo-mutators
779779
template<@\exposconcept{constexpr-param}@ T>
780780
constexpr auto operator++(this T) noexcept
781-
requires requires(T::value_type x) { ++x; }
782-
{ return constant_wrapper<[] { auto c = T::value; return ++c; }()>{}; }
781+
-> constant_wrapper<++Y> { return {}; }
783782
template<@\exposconcept{constexpr-param}@ T>
784783
constexpr auto operator++(this T, int) noexcept
785-
requires requires(T::value_type x) { x++; }
786-
{ return constant_wrapper<[] { auto c = T::value; return c++; }()>{}; }
787-
784+
-> constant_wrapper<Y++> { return {}; }
788785
template<@\exposconcept{constexpr-param}@ T>
789786
constexpr auto operator--(this T) noexcept
790-
requires requires(T::value_type x) { --x; }
791-
{ return constant_wrapper<[] { auto c = T::value; return --c; }()>{}; }
787+
-> constant_wrapper<--Y> { return {}; }
792788
template<@\exposconcept{constexpr-param}@ T>
793789
constexpr auto operator--(this T, int) noexcept
794-
requires requires(T::value_type x) { x--; }
795-
{ return constant_wrapper<[] { auto c = T::value; return c--; }()>{}; }
790+
-> constant_wrapper<Y--> { return {}; }
796791

797792
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
798-
constexpr auto operator+=(this T, R) noexcept
799-
requires requires(T::value_type x) { x += R::value; }
800-
{ return constant_wrapper<[] { auto v = T::value; return v += R::value; }()>{}; }
793+
constexpr auto operator+=(T, R) noexcept
794+
-> constant_wrapper<(T::value += R::value)> { return {}; }
801795
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
802-
constexpr auto operator-=(this T, R) noexcept
803-
requires requires(T::value_type x) { x -= R::value; }
804-
{ return constant_wrapper<[] { auto v = T::value; return v -= R::value; }()>{}; }
796+
constexpr auto operator-=(T, R) noexcept
797+
-> constant_wrapper<(T::value -= R::value)> { return {}; }
805798
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
806-
constexpr auto operator*=(this T, R) noexcept
807-
requires requires(T::value_type x) { x *= R::value; }
808-
{ return constant_wrapper<[] { auto v = T::value; return v *= R::value; }()>{}; }
799+
constexpr auto operator*=(T, R) noexcept
800+
-> constant_wrapper<(T::value *= R::value)> { return {}; }
809801
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
810-
constexpr auto operator/=(this T, R) noexcept
811-
requires requires(T::value_type x) { x /= R::value; }
812-
{ return constant_wrapper<[] { auto v = T::value; return v /= R::value; }()>{}; }
802+
constexpr auto operator/=(T, R) noexcept
803+
-> constant_wrapper<(T::value /= R::value)> { return {}; }
813804
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
814-
constexpr auto operator%=(this T, R) noexcept
815-
requires requires(T::value_type x) { x %= R::value; }
816-
{ return constant_wrapper<[] { auto v = T::value; return v %= R::value; }()>{}; }
805+
constexpr auto operator%=(T, R) noexcept
806+
-> constant_wrapper<(T::value %= R::value)> { return {}; }
817807
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
818-
constexpr auto operator&=(this T, R) noexcept
819-
requires requires(T::value_type x) { x &= R::value; }
820-
{ return constant_wrapper<[] { auto v = T::value; return v &= R::value; }()>{}; }
808+
constexpr auto operator&=(T, R) noexcept
809+
-> constant_wrapper<(T::value &= R::value)> { return {}; }
821810
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
822-
constexpr auto operator|=(this T, R) noexcept
823-
requires requires(T::value_type x) { x |= R::value; }
824-
{ return constant_wrapper<[] { auto v = T::value; return v |= R::value; }()>{}; }
811+
constexpr auto operator|=(T, R) noexcept
812+
-> constant_wrapper<(T::value |= R::value)> { return {}; }
825813
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
826-
constexpr auto operator^=(this T, R) noexcept
827-
requires requires(T::value_type x) { x ^= R::value; }
828-
{ return constant_wrapper<[] { auto v = T::value; return v ^= R::value; }()>{}; }
814+
constexpr auto operator^=(T, R) noexcept
815+
-> constant_wrapper<(T::value ^= R::value)> { return {}; }
829816
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
830-
constexpr auto operator<<=(this T, R) noexcept
831-
requires requires(T::value_type x) { x <<= R::value; }
832-
{ return constant_wrapper<[] { auto v = T::value; return v <<= R::value; }()>{}; }
817+
constexpr auto operator<<=(T, R) noexcept
818+
-> constant_wrapper<(T::value <<= R::value)> { return {}; }
833819
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@ R>
834-
constexpr auto operator>>=(this T, R) noexcept
835-
requires requires(T::value_type x) { x >>= R::value; }
836-
{ return constant_wrapper<[] { auto v = T::value; return v >>= R::value; }()>{}; }
820+
constexpr auto operator>>=(T, R) noexcept
821+
-> constant_wrapper<(T::value >>= R::value)> { return {}; }
837822
};
838823

839824
template<@\exposid{cw-fixed-value}@ X, class>
@@ -844,8 +829,7 @@
844829

845830
template<@\exposconcept{constexpr-param}@ R>
846831
constexpr auto operator=(R) const noexcept
847-
requires requires(value_type x) { x = R::value; }
848-
{ return constant_wrapper<[] { auto v = value; return v = R::value; }()>{}; }
832+
-> constant_wrapper<X = R::value> { return {}; }
849833

850834
constexpr operator decltype(auto)() const noexcept { return value; }
851835
};

0 commit comments

Comments
 (0)