Skip to content

Commit

Permalink
LWG2818 "::std::" everywhere rule needs tweaking
Browse files Browse the repository at this point in the history
 - Avoid introducing unused placeholder 'x'.
  • Loading branch information
jensmaurer committed Jun 12, 2021
1 parent 2907a06 commit 324554a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 44 deletions.
8 changes: 0 additions & 8 deletions source/iostreams.tex
Original file line number Diff line number Diff line change
Expand Up @@ -11512,8 +11512,6 @@

\rSec2[fs.req]{Requirements}

\rSec3[fs.req.general]{General}

\pnum
Throughout subclause~\ref{filesystems}, \tcode{char}, \keyword{wchar_t}, \keyword{char8_t},
\keyword{char16_t}, and \keyword{char32_t} are collectively called
Expand Down Expand Up @@ -11542,12 +11540,6 @@
Template parameters named \tcode{Allocator} shall meet the
\oldconcept{Allocator} requirements (\tref{cpp17.allocator}).

\rSec3[fs.req.namespace]{Namespaces and headers}

\pnum
Unless otherwise specified, references to entities described in
subclause~\ref{filesystems} are assumed to be qualified with \tcode{::std::filesystem::}.

\rSec2[fs.filesystem.syn]{Header \tcode{<filesystem>} synopsis}

\indexheader{filesystem}%
Expand Down
73 changes: 43 additions & 30 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -450,28 +450,30 @@
to aid in the specification of the library:
\indexlibrary{decay-copy@\tcode{\placeholder{decay-copy}}}%
\begin{codeblock}
template<class T> constexpr decay_t<T> @\placeholdernc{decay-copy}@(T&& v)
noexcept(is_nothrow_convertible_v<T, decay_t<T>>) // \expos
{ return std::forward<T>(v); }

constexpr auto @\placeholdernc{synth-three-way}@ =
[]<class T, class U>(const T& t, const U& u)
requires requires {
{ t < u } -> @\exposconcept{boolean-testable}@;
{ u < t } -> @\exposconcept{boolean-testable}@;
}
{
if constexpr (@\libconcept{three_way_comparable_with}@<T, U>) {
return t <=> u;
} else {
if (t < u) return weak_ordering::less;
if (u < t) return weak_ordering::greater;
return weak_ordering::equivalent;
}
};

template<class T, class U=T>
using @\placeholdernc{synth-three-way-result}@ = decltype(@\placeholdernc{synth-three-way}@(declval<T&>(), declval<U&>()));
namespace std {
template<class T> constexpr decay_t<T> @\placeholdernc{decay-copy}@(T&& v)
noexcept(is_nothrow_convertible_v<T, decay_t<T>>) // \expos
{ return std::forward<T>(v); }

constexpr auto @\placeholdernc{synth-three-way}@ =
[]<class T, class U>(const T& t, const U& u)
requires requires {
{ t < u } -> @\exposconcept{boolean-testable}@;
{ u < t } -> @\exposconcept{boolean-testable}@;
}
{
if constexpr (@\libconcept{three_way_comparable_with}@<T, U>) {
return t <=> u;
} else {
if (t < u) return weak_ordering::less;
if (u < t) return weak_ordering::greater;
return weak_ordering::equivalent;
}
};

template<class T, class U=T>
using @\placeholdernc{synth-three-way-result}@ = decltype(@\placeholdernc{synth-three-way}@(declval<T&>(), declval<U&>()));
}
\end{codeblock}

\rSec3[type.descriptions]{Type descriptions}
Expand Down Expand Up @@ -900,14 +902,25 @@
\end{footnote}

\pnum
Whenever a name \tcode{x} defined in the standard library is mentioned,
the name \tcode{x} is assumed to be fully qualified as
\tcode{::std::x},
unless explicitly described otherwise. For example, if the \effects element
for library function \tcode{F} is described as calling library function \tcode{G},
the function
\tcode{::std::G}
is meant.
Whenever an unqualified name is used
in the specification of a declaration \tcode{D}
in \ref{\firstlibchapter} through \ref{\lastlibchapter} or \ref{depr},
its meaning is established
as-if by performing unqualified name lookup\iref{basic.lookup.unqual}
in the context of \tcode{D}.
\begin{note}
Argument-dependent lookup is not performed.
\end{note}
Similarly, the meaning of a \grammarterm{qualified-id} is established
as-if by performing qualified name lookup\iref{basic.lookup.qual}
in the context of \tcode{D}.
\begin{example}
The reference to \tcode{is_array_v} in the specification of \tcode{std::to_array}\iref{array.creation} refers to \tcode{::std::is_array_v}.
\end{example}
\begin{note}
Operators in expressions\iref{over.match.oper} are not so constrained;
see \ref{global.functions}.
\end{note}

\rSec3[headers]{Headers}

Expand Down
12 changes: 6 additions & 6 deletions source/ranges.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1492,8 +1492,8 @@
requires @\libconcept{derived_from}@<tuple_size<T>, integral_constant<size_t, 2>>;
typename tuple_element_t<0, remove_const_t<T>>;
typename tuple_element_t<1, remove_const_t<T>>;
{ get<0>(t) } -> @\libconcept{convertible_to}@<const tuple_element_t<0, T>&>;
{ get<1>(t) } -> @\libconcept{convertible_to}@<const tuple_element_t<1, T>&>;
{ std::get<0>(t) } -> @\libconcept{convertible_to}@<const tuple_element_t<0, T>&>;
{ std::get<1>(t) } -> @\libconcept{convertible_to}@<const tuple_element_t<1, T>&>;
};

template<class T, class U, class V>
Expand Down Expand Up @@ -6360,7 +6360,7 @@
typename tuple_size<T>::type;
requires N < tuple_size_v<T>;
typename tuple_element_t<N, T>;
{ get<N>(t) } -> @\libconcept{convertible_to}@<const tuple_element_t<N, T>&>;
{ std::get<N>(t) } -> @\libconcept{convertible_to}@<const tuple_element_t<N, T>&>;
};

template<class T, size_t N>
Expand Down Expand Up @@ -6526,7 +6526,7 @@
\tcode{iterator_traits<iterator_t<\exposid{Base}>>::iterator_category}.
\begin{itemize}
\item
If \tcode{get<N>(*\exposid{current_})} is an rvalue,
If \tcode{std::get<N>(*\exposid{current_})} is an rvalue,
\tcode{iterator_category} denotes \tcode{input_iterator_tag}.
\item
Otherwise, if \tcode{C} models \tcode{\libconcept{derived_from}<random_access_iterator_tag>},
Expand All @@ -6546,10 +6546,10 @@
Equivalent to:
\begin{codeblock}
if constexpr (is_reference_v<range_reference_t<@\exposid{Base}@>>) {
return get<N>(*i);
return std::get<N>(*i);
} else {
using E = remove_cv_t<tuple_element_t<N, range_reference_t<@\exposid{Base}@>>>;
return static_cast<E>(get<N>(*i));
return static_cast<E>(std::get<N>(*i));
}
\end{codeblock}
\end{itemdescr}
Expand Down
4 changes: 4 additions & 0 deletions source/xrefdelta.tex
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@
\movedxref{forwardlist.modifiers}{forward.list.modifiers}
\movedxref{forwardlist.ops}{forward.list.ops}

% LWG2818 "::std::" everywhere rule needs tweaking
\removedxref{fs.req.namespace}
\movedxref{fs.req.general}{fs.req}

% Deprecated features.
%\deprxref{old.label} (if moved to depr.old.label, otherwise use \movedxref)

0 comments on commit 324554a

Please sign in to comment.