ericniebler/stl2

Writable should work with rvalues

CaseyCarter opened this issue · 1 comments

During LWG Kona review of D0547R1. Writable is defined therein as:

template <class Out, class T>
concept bool Writable() {
  return requires(Out& o, T&& t) {
    *o = std::forward<T>(t);
  };
}

The concept only requires writability for lvalues, but it seems reasonable to require that writability is oblivious to value category.

Proposed Resolution

Accept the wording in P0547R1.

SUPERSEDED (Well, not really: this wording was incorporated into P0547R1)

Wording relative to D0547R1. Change the definition of the concept Writable in [iterators.writable] as follows:

 template <class Out, class T>
 concept bool Writable() {
-  return requires(Out& o, T&& t) {
-    *o = std::forward<T>(t);
+  return requires(Out& o1, Out&& o2, T&& t) {
+    *o1 = std::forward<T>(t);
+    *std::forward<Out>(o2) = std::forward<T>(t);
   };
 }

We need to combine this resolution with the one from #381.