Skip to content

Commit 96d4993

Browse files
jensmaurertkoeppe
authored andcommitted
LWG3549 view_interface is overspecified to derive from view_base
1 parent 83ebaa1 commit 96d4993

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

source/ranges.tex

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,10 +1227,22 @@
12271227
\indexlibraryglobal{enable_view}%
12281228
\begin{itemdecl}
12291229
template<class T>
1230-
inline constexpr bool enable_view = @\libconcept{derived_from}@<T, view_base>;
1230+
inline constexpr bool @\exposid{is-derived-from-view-interface}@ = @\seebelow@; // \expos
1231+
template<class T>
1232+
inline constexpr bool enable_view =
1233+
@\libconcept{derived_from}@<T, view_base> || @\exposid{is-derived-from-view-interface}@<T>;
12311234
\end{itemdecl}
12321235

12331236
\begin{itemdescr}
1237+
\pnum
1238+
For a type \tcode{T},
1239+
\tcode{\exposid{is-derived-from-view-interface}<T>} is \tcode{true}
1240+
if and only if
1241+
\tcode{T} has exactly one public base class \tcode{view_interface<U>}
1242+
for some type \tcode{U} and
1243+
\tcode{T} has no base classes of type \tcode{view_interface<V>}
1244+
for any other type \tcode{V}.
1245+
12341246
\pnum
12351247
\remarks
12361248
Pursuant to \ref{namespace.std}, users may specialize \tcode{enable_view}
@@ -1363,7 +1375,7 @@
13631375
namespace std::ranges {
13641376
template<class D>
13651377
requires is_class_v<D> && @\libconcept{same_as}@<D, remove_cv_t<D>>
1366-
class view_interface : public view_base {
1378+
class view_interface {
13671379
private:
13681380
constexpr D& @\exposid{derived}@() noexcept { // \expos
13691381
return static_cast<D&>(*this);

0 commit comments

Comments
 (0)