Skip to content

Commit f069a82

Browse files
committed
[const.wrap.class] Extensive line breaking to fit properly on the page
1 parent b3d2eca commit f069a82

File tree

1 file changed

+106
-62
lines changed

1 file changed

+106
-62
lines changed

source/meta.tex

Lines changed: 106 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -657,68 +657,95 @@
657657
};
658658

659659
template<class T, size_t Extent>
660-
cw-fixed-value(T (&)[Extent]) -> cw-fixed-value<T[Extent]>; // \expos
660+
@\exposid{cw-fixed-value}@(T (&)[Extent]) -> cw-fixed-value<T[Extent]>; // \expos
661661

662662
struct @\exposid{cw-operators}@ { // \expos
663663
// unary operators
664664
template<@\exposid{constexpr-param}@ T>
665-
friend constexpr auto operator+(T) noexcept -> constant_wrapper<(+T::value)> { return {}; }
665+
friend constexpr auto operator+(T) noexcept -> constant_wrapper<(+T::value)>
666+
{ return {}; }
666667
template<@\exposid{constexpr-param}@ T>
667-
friend constexpr auto operator-(T) noexcept -> constant_wrapper<(-T::value)> { return {}; }
668+
friend constexpr auto operator-(T) noexcept -> constant_wrapper<(-T::value)>
669+
{ return {}; }
668670
template<@\exposid{constexpr-param}@ T>
669-
friend constexpr auto operator~(T) noexcept -> constant_wrapper<(~T::value)> { return {}; }
671+
friend constexpr auto operator~(T) noexcept -> constant_wrapper<(~T::value)>
672+
{ return {}; }
670673
template<@\exposid{constexpr-param}@ T>
671-
friend constexpr auto operator!(T) noexcept -> constant_wrapper<(!T::value)> { return {}; }
674+
friend constexpr auto operator!(T) noexcept -> constant_wrapper<(!T::value)>
675+
{ return {}; }
672676
template<@\exposid{constexpr-param}@ T>
673-
friend constexpr auto operator&(T) noexcept -> constant_wrapper<(&T::value)> { return {}; }
677+
friend constexpr auto operator&(T) noexcept -> constant_wrapper<(&T::value)>
678+
{ return {}; }
674679
template<@\exposid{constexpr-param}@ T>
675-
friend constexpr auto operator*(T) noexcept -> constant_wrapper<(*T::value)> { return {}; }
680+
friend constexpr auto operator*(T) noexcept -> constant_wrapper<(*T::value)>
681+
{ return {}; }
676682

677683
// binary operators
678684
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
679-
friend constexpr auto operator+(L, R) noexcept -> constant_wrapper<(L::value + R::value)> { return {}; }
685+
friend constexpr auto operator+(L, R) noexcept -> constant_wrapper<(L::value + R::value)>
686+
{ return {}; }
680687
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
681-
friend constexpr auto operator-(L, R) noexcept -> constant_wrapper<(L::value - R::value)> { return {}; }
688+
friend constexpr auto operator-(L, R) noexcept -> constant_wrapper<(L::value - R::value)>
689+
{ return {}; }
682690
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
683-
friend constexpr auto operator*(L, R) noexcept -> constant_wrapper<(L::value * R::value)> { return {}; }
691+
friend constexpr auto operator*(L, R) noexcept -> constant_wrapper<(L::value * R::value)>
692+
{ return {}; }
684693
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
685-
friend constexpr auto operator/(L, R) noexcept -> constant_wrapper<(L::value / R::value)> { return {}; }
694+
friend constexpr auto operator/(L, R) noexcept -> constant_wrapper<(L::value / R::value)>
695+
{ return {}; }
686696
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
687-
friend constexpr auto operator%(L, R) noexcept -> constant_wrapper<(L::value % R::value)> { return {}; }
697+
friend constexpr auto operator%(L, R) noexcept -> constant_wrapper<(L::value % R::value)>
698+
{ return {}; }
688699

689700
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
690-
friend constexpr auto operator<<(L, R) noexcept -> constant_wrapper<(L::value << R::value)> { return {}; }
701+
friend constexpr auto operator<<(L, R) noexcept -> constant_wrapper<(L::value << R::value)>
702+
{ return {}; }
691703
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
692-
friend constexpr auto operator>>(L, R) noexcept -> constant_wrapper<(L::value >> R::value)> { return {}; }
704+
friend constexpr auto operator>>(L, R) noexcept -> constant_wrapper<(L::value >> R::value)>
705+
{ return {}; }
693706
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
694-
friend constexpr auto operator&(L, R) noexcept -> constant_wrapper<(L::value & R::value)> { return {}; }
707+
friend constexpr auto operator&(L, R) noexcept -> constant_wrapper<(L::value & R::value)>
708+
{ return {}; }
695709
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
696-
friend constexpr auto operator|(L, R) noexcept -> constant_wrapper<(L::value | R::value)> { return {}; }
710+
friend constexpr auto operator|(L, R) noexcept -> constant_wrapper<(L::value | R::value)>
711+
{ return {}; }
697712
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
698-
friend constexpr auto operator^(L, R) noexcept -> constant_wrapper<(L::value ^ R::value)> { return {}; }
713+
friend constexpr auto operator^(L, R) noexcept -> constant_wrapper<(L::value ^ R::value)>
714+
{ return {}; }
699715

700716
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
701-
requires (!is_constructible_v<bool, decltype(L::value)> || !is_constructible_v<bool, decltype(R::value)>)
702-
friend constexpr auto operator&&(L, R) noexcept -> constant_wrapper<(L::value && R::value)> { return {}; }
717+
requires (!is_constructible_v<bool, decltype(L::value)> ||
718+
!is_constructible_v<bool, decltype(R::value)>)
719+
friend constexpr auto operator&&(L, R) noexcept -> constant_wrapper<(L::value && R::value)>
720+
{ return {}; }
703721
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
704-
requires (!is_constructible_v<bool, decltype(L::value)> || !is_constructible_v<bool, decltype(R::value)>)
705-
friend constexpr auto operator||(L, R) noexcept -> constant_wrapper<(L::value || R::value)> { return {}; }
722+
requires (!is_constructible_v<bool, decltype(L::value)> ||
723+
!is_constructible_v<bool, decltype(R::value)>)
724+
friend constexpr auto operator||(L, R) noexcept -> constant_wrapper<(L::value || R::value)>
725+
{ return {}; }
706726

707727
// comparisons
708728
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
709-
friend constexpr auto operator<=>(L, R) noexcept -> constant_wrapper<(L::value <=> R::value)> { return {}; }
729+
friend constexpr auto operator<=>(L, R) noexcept -> constant_wrapper<(L::value <=> R::value)>
730+
{ return {}; }
710731
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
711-
friend constexpr auto operator<(L, R) noexcept -> constant_wrapper<(L::value < R::value)> { return {}; }
732+
friend constexpr auto operator<(L, R) noexcept -> constant_wrapper<(L::value < R::value)>
733+
{ return {}; }
712734
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
713-
friend constexpr auto operator<=(L, R) noexcept -> constant_wrapper<(L::value <= R::value)> { return {}; }
735+
friend constexpr auto operator<=(L, R) noexcept -> constant_wrapper<(L::value <= R::value)>
736+
{ return {}; }
714737
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
715-
friend constexpr auto operator==(L, R) noexcept -> constant_wrapper<(L::value == R::value)> { return {}; }
738+
friend constexpr auto operator==(L, R) noexcept -> constant_wrapper<(L::value == R::value)>
739+
{ return {}; }
716740
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
717-
friend constexpr auto operator!=(L, R) noexcept -> constant_wrapper<(L::value != R::value)> { return {}; }
741+
friend constexpr auto operator!=(L, R) noexcept -> constant_wrapper<(L::value != R::value)>
742+
{ return {}; }
718743
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
719-
friend constexpr auto operator>(L, R) noexcept -> constant_wrapper<(L::value > R::value)> { return {}; }
744+
friend constexpr auto operator>(L, R) noexcept -> constant_wrapper<(L::value > R::value)>
745+
{ return {}; }
720746
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
721-
friend constexpr auto operator>=(L, R) noexcept -> constant_wrapper<(L::value >= R::value)> { return {}; }
747+
friend constexpr auto operator>=(L, R) noexcept -> constant_wrapper<(L::value >= R::value)>
748+
{ return {}; }
722749

723750
template<@\exposid{constexpr-param}@ L, @\exposid{constexpr-param}@ R>
724751
friend constexpr auto operator,(L, R) noexcept = delete;
@@ -732,65 +759,81 @@
732759
requires requires(Args...) { constant_wrapper<T::value(Args::value...)>(); }
733760
{ return constant_wrapper<T::value(Args::value...)>{}; }
734761
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@... Args>
735-
constexpr auto operator[](this T, Args...) noexcept -> constant_wrapper<(T::value[Args::value...])>
736-
{ return {}; }
762+
constexpr auto operator[](this T, Args...) noexcept
763+
-> constant_wrapper<(T::value[Args::value...])>
764+
{ return {}; }
737765

738766
// pseudo-mutators
739767
template<@\exposid{constexpr-param}@ T>
740-
constexpr auto operator++(this T) noexcept requires requires(T::value_type x) { ++x; }
741-
{ return constant_wrapper<[] { auto c = T::value; return ++c; }()>{}; }
768+
constexpr auto operator++(this T) noexcept
769+
requires requires(T::value_type x) { ++x; }
770+
{ return constant_wrapper<[] { auto c = T::value; return ++c; }()>{}; }
742771
template<@\exposid{constexpr-param}@ T>
743-
constexpr auto operator++(this T, int) noexcept requires requires(T::value_type x) { x++; }
744-
{ return constant_wrapper<[] { auto c = T::value; return c++; }()>{}; }
772+
constexpr auto operator++(this T, int) noexcept
773+
requires requires(T::value_type x) { x++; }
774+
{ return constant_wrapper<[] { auto c = T::value; return c++; }()>{}; }
745775

746776
template<@\exposid{constexpr-param}@ T>
747-
constexpr auto operator--(this T) noexcept requires requires(T::value_type x) { --x; }
748-
{ return constant_wrapper<[] { auto c = T::value; return --c; }()>{}; }
777+
constexpr auto operator--(this T) noexcept
778+
requires requires(T::value_type x) { --x; }
779+
{ return constant_wrapper<[] { auto c = T::value; return --c; }()>{}; }
749780
template<@\exposid{constexpr-param}@ T>
750-
constexpr auto operator--(this T, int) noexcept requires requires(T::value_type x) { x--; }
751-
{ return constant_wrapper<[] { auto c = T::value; return c--; }()>{}; }
781+
constexpr auto operator--(this T, int) noexcept
782+
requires requires(T::value_type x) { x--; }
783+
{ return constant_wrapper<[] { auto c = T::value; return c--; }()>{}; }
752784

753785
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
754-
constexpr auto operator+=(this T, R) noexcept requires requires(T::value_type x) { x += R::value; }
755-
{ return constant_wrapper<[] { auto v = T::value; return v += R::value; }()>{}; }
786+
constexpr auto operator+=(this T, R) noexcept
787+
requires requires(T::value_type x) { x += R::value; }
788+
{ return constant_wrapper<[] { auto v = T::value; return v += R::value; }()>{}; }
756789
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
757-
constexpr auto operator-=(this T, R) noexcept requires requires(T::value_type x) { x -= R::value; }
758-
{ return constant_wrapper<[] { auto v = T::value; return v -= R::value; }()>{}; }
790+
constexpr auto operator-=(this T, R) noexcept
791+
requires requires(T::value_type x) { x -= R::value; }
792+
{ return constant_wrapper<[] { auto v = T::value; return v -= R::value; }()>{}; }
759793
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
760-
constexpr auto operator*=(this T, R) noexcept requires requires(T::value_type x) { x *= R::value; }
761-
{ return constant_wrapper<[] { auto v = T::value; return v *= R::value; }()>{}; }
794+
constexpr auto operator*=(this T, R) noexcept
795+
requires requires(T::value_type x) { x *= R::value; }
796+
{ return constant_wrapper<[] { auto v = T::value; return v *= R::value; }()>{}; }
762797
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
763-
constexpr auto operator/=(this T, R) noexcept requires requires(T::value_type x) { x /= R::value; }
764-
{ return constant_wrapper<[] { auto v = T::value; return v /= R::value; }()>{}; }
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; }()>{}; }
765801
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
766-
constexpr auto operator%=(this T, R) noexcept requires requires(T::value_type x) { x %= R::value; }
767-
{ return constant_wrapper<[] { auto v = T::value; return v %= R::value; }()>{}; }
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; }()>{}; }
768805
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
769-
constexpr auto operator&=(this T, R) noexcept requires requires(T::value_type x) { x &= R::value; }
770-
{ return constant_wrapper<[] { auto v = T::value; return v &= R::value; }()>{}; }
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; }()>{}; }
771809
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
772-
constexpr auto operator|=(this T, R) noexcept requires requires(T::value_type x) { x |= R::value; }
773-
{ return constant_wrapper<[] { auto v = T::value; return v |= R::value; }()>{}; }
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; }()>{}; }
774813
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
775-
constexpr auto operator^=(this T, R) noexcept requires requires(T::value_type x) { x ^= R::value; }
776-
{ return constant_wrapper<[] { auto v = T::value; return v ^= R::value; }()>{}; }
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; }()>{}; }
777817
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
778-
constexpr auto operator<<=(this T, R) noexcept requires requires(T::value_type x) { x <<= R::value; }
779-
{ return constant_wrapper<[] { auto v = T::value; return v <<= R::value; }()>{}; }
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; }()>{}; }
780821
template<@\exposid{constexpr-param}@ T, @\exposid{constexpr-param}@ R>
781-
constexpr auto operator>>=(this T, R) noexcept requires requires(T::value_type x) { x >>= R::value; }
782-
{ return constant_wrapper<[] { auto v = T::value; return v >>= R::value; }()>{}; }
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; }()>{}; }
783825
};
784826

785-
template<cw-fixed-value X, class>
827+
template<@\exposid{cw-fixed-value}@ X, class>
786828
struct constant_wrapper: cw-operators {
787829
static constexpr const auto & value = X.data;
788830
using type = constant_wrapper;
789831
using value_type = typename decltype(X)::type;
790832

791833
template<@\exposid{constexpr-param}@ R>
792-
constexpr auto operator=(R) const noexcept requires requires(value_type x) { x = R::value; }
793-
{ return constant_wrapper<[] { auto v = value; return v = R::value; }()>{}; }
834+
constexpr auto operator=(R) const noexcept
835+
requires requires(value_type x) { x = R::value; }
836+
{ return constant_wrapper<[] { auto v = value; return v = R::value; }()>{}; }
794837

795838
constexpr operator decltype(auto)() const noexcept { return value; }
796839
};
@@ -838,7 +881,8 @@
838881
void deeply_flawed_underground_planning() {
839882
constexpr auto gathered_quantity = middle_phase(initial_phase(42, 13));
840883
constexpr auto all_available = 55;
841-
final_phase(gathered_quantity, all_available); // error: `gathered == available' is not a constant expression
884+
final_phase(gathered_quantity, all_available); // error:
885+
// `gathered == available' is not a constant expression
842886
}
843887
\end{codeblock}
844888
\end{example}

0 commit comments

Comments
 (0)