Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 63 additions & 10 deletions source/meta.tex
Original file line number Diff line number Diff line change
Expand Up @@ -797,16 +797,6 @@
friend constexpr auto operator->*(L, R) noexcept -> constant_wrapper<L::value->*(R::value)>
{ return {}; }

// call and index
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@... Args>
constexpr auto operator()(this T, Args...) noexcept
requires requires { constant_wrapper<T::value(Args::value...)>(); }
{ return constant_wrapper<T::value(Args::value...)>{}; }
template<@\exposconcept{constexpr-param}@ T, @\exposconcept{constexpr-param}@... Args>
constexpr auto operator[](this T, Args...) noexcept
-> constant_wrapper<(T::value[Args::value...])>
{ return {}; }

// pseudo-mutators
template<@\exposconcept{constexpr-param}@ T>
constexpr auto operator++(this T) noexcept
Expand Down Expand Up @@ -864,6 +854,11 @@
-> constant_wrapper<X = R::value> { return {}; }

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

template<class... Args>
static constexpr decltype(auto) operator()(Args&&... args) noexcept(@\seebelow@);
template<class... Args>
static constexpr decltype(auto) operator[](Args&&... args) noexcept(@\seebelow@);
};
}
\end{codeblock}
Expand Down Expand Up @@ -926,6 +921,64 @@
Initialize elements of \exposid{data} with corresponding elements of \tcode{arr}.
\end{itemdescr}

\indexlibrarymember{operator()}{constant_wrapper}%
\begin{itemdecl}
template<class... Args>
static constexpr decltype(auto) operator()(Args&&... args) noexcept(@\seebelow@);
\end{itemdecl}

\begin{itemdescr}
\pnum
Let \tcode{\placeholder{call-expr}} be
\tcode{constant_wrapper<\placeholder{INVOKE}(value,
remove_cvref_t<Args>::value...)>\{\}} if all types in
\tcode{remove_cvref_t<Args>...} satisfy \exposconcept{constexpr-param} and
\tcode{constant_wrapper<\placeholder{INVOKE}(val\-ue,
remove_cvref_t<Args>::value...)>} is a valid type, otherwise let
\tcode{\placeholder{call-expr}} be \tcode{\placeholder{INVOKE}(value,
std::forward<Args>(args)...)}.

\pnum
\constraints
\tcode{\placeholder{call-expr}} is a valid expression.

\pnum
\effects
Equivalent to: \tcode{return \placeholder{call-expr};}

\pnum
\remarks
The exception specification is equivalent to \tcode{noexcept(\placeholder{call-expr})}.
\end{itemdescr}

\indexlibrarymember{operator[]}{constant_wrapper}%
\begin{itemdecl}
template<class... Args>
static constexpr decltype(auto) operator[](Args&&... args) noexcept(@\seebelow@);
\end{itemdecl}

\begin{itemdescr}
\pnum
Let \tcode{\placeholder{subscr-expr}} be
\tcode{constant_wrapper<value[remove_cvref_t<Args>::value...]>\{\}} if all
types in \tcode{remove_cvref_t<Args>...} satisfy \exposconcept{constexpr-param}
and \tcode{constant_wrapper<value[remove_cv\-ref_t<Args>::value...]>} is a valid
type, otherwise let \tcode{\placeholder{subscr-expr}} be
\tcode{value[std::forward<Args\brk{}>(args)...]}.

\pnum
\constraints
\tcode{\placeholder{subscr-expr}} is a valid expression.

\pnum
\effects
Equivalent to: \tcode{return \placeholder{subscr-expr};}

\pnum
\remarks
The exception specification is equivalent to \tcode{noexcept(\placeholder{subscr-expr})}.
\end{itemdescr}

\rSec2[meta.unary]{Unary type traits}

\rSec3[meta.unary.general]{General}
Expand Down
2 changes: 1 addition & 1 deletion source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@
#define @\defnlibxname{cpp_lib_complex_udls}@ 201309L // also in \libheader{complex}
#define @\defnlibxname{cpp_lib_concepts}@ 202207L
// freestanding, also in \libheader{concepts}, \libheader{compare}
#define @\defnlibxname{cpp_lib_constant_wrapper}@ 202506L // freestanding, also in \libheader{type_traits}
#define @\defnlibxname{cpp_lib_constant_wrapper}@ 202603L // freestanding, also in \libheader{utility}
#define @\defnlibxname{cpp_lib_constexpr_algorithms}@ 202306L // also in \libheader{algorithm}, \libheader{utility}
#define @\defnlibxname{cpp_lib_constexpr_atomic}@ 202411L // also in \libheader{atomic}
#define @\defnlibxname{cpp_lib_constexpr_bitset}@ 202207L // also in \libheader{bitset}
Expand Down
Loading