[libcxx-commits] [PATCH] D155276: [libc++] Implement ostringstream members of P0408R7 (Efficient Access to basic_stringbuf's Buffer)

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 15 12:06:47 PDT 2023


Mordante added inline comments.


================
Comment at: libcxx/include/sstream:967
+    template <class _SAlloc>
+    _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+                                                       ios_base::openmode __wch = ios_base::out)
----------------
pfusik wrote:
> Mordante wrote:
> > This overload should be constrained `is_same_v<SAlloc,Allocator> is false`
> Also in `istringstream` and `stringstream`.
> 
> It seems to work fine without the explicit constraint, selecting the non-template constructor, e.g. `ostringstream.cons/string.pass.cpp`.
> I think this is because https://timsong-cpp.github.io/cppwp/over.match.best#general-2.4
> 
> Or do we need to have "requires" every time the standard says "Constraints:" ?
The overload resolution indeed selects the expected function. However the function is a viable function, which it should not be per http://eel.is/c++draft/description#structure.specifications-3.1

Note I think that page of the standard contains a lot of information regarding the standard library. You might want to read a bit more on that page.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155276/new/

https://reviews.llvm.org/D155276



More information about the libcxx-commits mailing list