Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P2231R1 Missing constexpr in std::optional and std::variant #4679

Merged
merged 1 commit into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@
// \libheader{unordered_map}, \libheader{unordered_set}, \libheader{vector}
#define @\defnlibxname{cpp_lib_not_fn}@ 201603L // also in \libheader{functional}
#define @\defnlibxname{cpp_lib_null_iterators}@ 201304L // also in \libheader{iterator}
#define @\defnlibxname{cpp_lib_optional}@ 201606L // also in \libheader{optional}
#define @\defnlibxname{cpp_lib_optional}@ 202106L // also in \libheader{optional}
#define @\defnlibxname{cpp_lib_out_ptr}@ 202106L // also in \libheader{memory}
#define @\defnlibxname{cpp_lib_parallel_algorithm}@ 201603L // also in \libheader{algorithm}, \libheader{numeric}
#define @\defnlibxname{cpp_lib_polymorphic_allocator}@ 201902L // also in \libheader{memory_resource}
Expand Down Expand Up @@ -701,7 +701,7 @@
#define @\defnlibxname{cpp_lib_uncaught_exceptions}@ 201411L // also in \libheader{exception}
#define @\defnlibxname{cpp_lib_unordered_map_try_emplace}@ 201411L // also in \libheader{unordered_map}
#define @\defnlibxname{cpp_lib_unwrap_ref}@ 201811L // also in \libheader{type_traits}
#define @\defnlibxname{cpp_lib_variant}@ 202102L // also in \libheader{variant}
#define @\defnlibxname{cpp_lib_variant}@ 202106L // also in \libheader{variant}
#define @\defnlibxname{cpp_lib_void_t}@ 201411L // also in \libheader{type_traits}
\end{codeblock}

Expand Down
84 changes: 44 additions & 40 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@

// \ref{optional.specalg}, specialized algorithms
template<class T>
void swap(optional<T>&, optional<T>&) noexcept(@\seebelow@);
constexpr void swap(optional<T>&, optional<T>&) noexcept(@\seebelow@);

template<class T>
constexpr optional<@\seebelow@> make_optional(T&&);
Expand Down Expand Up @@ -2482,25 +2482,25 @@
template<class U = T>
constexpr explicit(@\seebelow@) optional(U&&);
template<class U>
explicit(@\seebelow@) optional(const optional<U>&);
constexpr explicit(@\seebelow@) optional(const optional<U>&);
template<class U>
explicit(@\seebelow@) optional(optional<U>&&);
constexpr explicit(@\seebelow@) optional(optional<U>&&);

// \ref{optional.dtor}, destructor
~optional();
constexpr ~optional();

// \ref{optional.assign}, assignment
optional& operator=(nullopt_t) noexcept;
constexpr optional& operator=(nullopt_t) noexcept;
constexpr optional& operator=(const optional&);
constexpr optional& operator=(optional&&) noexcept(@\seebelow@);
template<class U = T> optional& operator=(U&&);
template<class U> optional& operator=(const optional<U>&);
template<class U> optional& operator=(optional<U>&&);
template<class... Args> T& emplace(Args&&...);
template<class U, class... Args> T& emplace(initializer_list<U>, Args&&...);
template<class U = T> constexpr optional& operator=(U&&);
template<class U> constexpr optional& operator=(const optional<U>&);
template<class U> constexpr optional& operator=(optional<U>&&);
template<class... Args> constexpr T& emplace(Args&&...);
template<class U, class... Args> constexpr T& emplace(initializer_list<U>, Args&&...);

// \ref{optional.swap}, swap
void swap(optional&) noexcept(@\seebelow@);
constexpr void swap(optional&) noexcept(@\seebelow@);

// \ref{optional.observe}, observers
constexpr const T* operator->() const;
Expand All @@ -2519,7 +2519,7 @@
template<class U> constexpr T value_or(U&&) &&;

// \ref{optional.mod}, modifiers
void reset() noexcept;
constexpr void reset() noexcept;

private:
T *val; // \expos
Expand Down Expand Up @@ -2719,7 +2719,7 @@

\indexlibraryctor{optional}%
\begin{itemdecl}
template<class U> explicit(@\seebelow@) optional(const optional<U>& rhs);
template<class U> constexpr explicit(@\seebelow@) optional(const optional<U>& rhs);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -2761,7 +2761,7 @@

\indexlibraryctor{optional}%
\begin{itemdecl}
template<class U> explicit(@\seebelow@) optional(optional<U>&& rhs);
template<class U> constexpr explicit(@\seebelow@) optional(optional<U>&& rhs);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -2806,7 +2806,7 @@

\indexlibrarydtor{optional}%
\begin{itemdecl}
~optional();
constexpr ~optional();
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -2826,7 +2826,7 @@

\indexlibrarymember{operator=}{optional}%
\begin{itemdecl}
optional<T>& operator=(nullopt_t) noexcept;
constexpr optional<T>& operator=(nullopt_t) noexcept;
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -2947,7 +2947,7 @@

\indexlibrarymember{operator=}{optional}%
\begin{itemdecl}
template<class U = T> optional<T>& operator=(U&& v);
template<class U = T> constexpr optional<T>& operator=(U&& v);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -2977,7 +2977,7 @@

\indexlibrarymember{operator=}{optional}%
\begin{itemdecl}
template<class U> optional<T>& operator=(const optional<U>& rhs);
template<class U> constexpr optional<T>& operator=(const optional<U>& rhs);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -3040,7 +3040,7 @@

\indexlibrarymember{operator=}{optional}%
\begin{itemdecl}
template<class U> optional<T>& operator=(optional<U>&& rhs);
template<class U> constexpr optional<T>& operator=(optional<U>&& rhs);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -3104,7 +3104,7 @@

\indexlibrarymember{emplace}{optional}%
\begin{itemdecl}
template<class... Args> T& emplace(Args&&... args);
template<class... Args> constexpr T& emplace(Args&&... args);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -3135,7 +3135,7 @@

\indexlibrarymember{emplace}{optional}%
\begin{itemdecl}
template<class U, class... Args> T& emplace(initializer_list<U> il, Args&&... args);
template<class U, class... Args> constexpr T& emplace(initializer_list<U> il, Args&&... args);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -3168,7 +3168,7 @@

\indexlibrarymember{swap}{optional}%
\begin{itemdecl}
void swap(optional& rhs) noexcept(@\seebelow@);
constexpr void swap(optional& rhs) noexcept(@\seebelow@);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -3389,7 +3389,7 @@

\indexlibrarymember{reset}{optional}%
\begin{itemdecl}
void reset() noexcept;
constexpr void reset() noexcept;
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -3848,7 +3848,8 @@

\indexlibrarymember{swap}{optional}%
\begin{itemdecl}
template<class T> void swap(optional<T>& x, optional<T>& y) noexcept(noexcept(x.swap(y)));
template<class T>
constexpr void swap(optional<T>& x, optional<T>& y) noexcept(noexcept(x.swap(y)));
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -4024,7 +4025,7 @@

// \ref{variant.specalg}, specialized algorithms
template<class... Types>
void swap(variant<Types...>&, variant<Types...>&) noexcept(@\seebelow@);
constexpr void swap(variant<Types...>&, variant<Types...>&) noexcept(@\seebelow@);

// \ref{variant.bad.access}, class \tcode{bad_variant_access}
class bad_variant_access;
Expand Down Expand Up @@ -4065,30 +4066,31 @@
constexpr explicit variant(in_place_index_t<I>, initializer_list<U>, Args&&...);

// \ref{variant.dtor}, destructor
~variant();
constepxr ~variant();

// \ref{variant.assign}, assignment
constexpr variant& operator=(const variant&);
constexpr variant& operator=(variant&&) noexcept(@\seebelow@);

template<class T> variant& operator=(T&&) noexcept(@\seebelow@);
template<class T> constexpr variant& operator=(T&&) noexcept(@\seebelow@);

// \ref{variant.mod}, modifiers
template<class T, class... Args>
T& emplace(Args&&...);
constexpr T& emplace(Args&&...);
template<class T, class U, class... Args>
T& emplace(initializer_list<U>, Args&&...);
constexpr T& emplace(initializer_list<U>, Args&&...);
template<size_t I, class... Args>
variant_alternative_t<I, variant<Types...>>& emplace(Args&&...);
constexpr variant_alternative_t<I, variant<Types...>>& emplace(Args&&...);
template<size_t I, class U, class... Args>
variant_alternative_t<I, variant<Types...>>& emplace(initializer_list<U>, Args&&...);
constexpr variant_alternative_t<I, variant<Types...>>&
emplace(initializer_list<U>, Args&&...);

// \ref{variant.status}, value status
constexpr bool valueless_by_exception() const noexcept;
constexpr size_t index() const noexcept;

// \ref{variant.swap}, swap
void swap(variant&) noexcept(@\seebelow@);
constexpr void swap(variant&) noexcept(@\seebelow@);
};
}
\end{codeblock}
Expand Down Expand Up @@ -4414,7 +4416,7 @@

\indexlibrarydtor{variant}%
\begin{itemdecl}
~variant();
constexpr ~variant();
jensmaurer marked this conversation as resolved.
Show resolved Hide resolved
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -4533,7 +4535,7 @@

\indexlibrarymember{operator=}{variant}%
\begin{itemdecl}
template<class T> variant& operator=(T&& t) noexcept(@\seebelow@);
template<class T> constexpr variant& operator=(T&& t) noexcept(@\seebelow@);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -4615,7 +4617,7 @@

\indexlibrarymember{emplace}{variant}%
\begin{itemdecl}
template<class T, class... Args> T& emplace(Args&&... args);
template<class T, class... Args> constexpr T& emplace(Args&&... args);
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -4635,7 +4637,8 @@

\indexlibrarymember{emplace}{variant}%
\begin{itemdecl}
template<class T, class U, class... Args> T& emplace(initializer_list<U> il, Args&&... args);
template<class T, class U, class... Args>
constexpr T& emplace(initializer_list<U> il, Args&&... args);
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -4656,7 +4659,7 @@
\indexlibrarymember{emplace}{variant}%
\begin{itemdecl}
template<size_t I, class... Args>
variant_alternative_t<I, variant<Types...>>& emplace(Args&&... args);
constexpr variant_alternative_t<I, variant<Types...>>& emplace(Args&&... args);
\end{itemdecl}

\begin{itemdescr} % NOCHECK: order
Expand Down Expand Up @@ -4697,7 +4700,8 @@
\indexlibrarymember{emplace}{variant}%
\begin{itemdecl}
template<size_t I, class U, class... Args>
variant_alternative_t<I, variant<Types...>>& emplace(initializer_list<U> il, Args&&... args);
constexpr variant_alternative_t<I, variant<Types...>>&
emplace(initializer_list<U> il, Args&&... args);
\end{itemdecl}

\begin{itemdescr} % NOCHECK: order
Expand Down Expand Up @@ -4778,7 +4782,7 @@

\indexlibrarymember{swap}{variant}%
\begin{itemdecl}
void swap(variant& rhs) noexcept(@\seebelow@);
constexpr void swap(variant& rhs) noexcept(@\seebelow@);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -5250,7 +5254,7 @@
\indexlibrarymember{swap}{variant}%
\begin{itemdecl}
template<class... Types>
void swap(variant<Types...>& v, variant<Types...>& w) noexcept(@\seebelow@);
constexpr void swap(variant<Types...>& v, variant<Types...>& w) noexcept(@\seebelow@);
\end{itemdecl}

\begin{itemdescr}
Expand Down