Open Bug 1353331 Opened 9 years ago Updated 4 years ago

MakeSpan() doesn't work with std::string

Categories

(Core :: MFBT, enhancement)

enhancement

Tracking

()

People

(Reporter: hsivonen, Unassigned)

Details

These: /** * Create span from standard-library container. */ template<class Container> Span<typename Container::value_type> MakeSpan(Container& cont) { return Span<typename Container::value_type>(cont); } /** * Create span from standard-library container (const version). */ template<class Container> Span<const typename Container::value_type> MakeSpan(const Container& cont) { return Span<const typename Container::value_type>(cont); } ...are supposed to work with std::string but don't. The constructor of Span<char> or Span<const char> does work.
(In reply to Henri Sivonen (:hsivonen) from comment #0) > The constructor of > Span<char> or Span<const char> does work. Well, the latter works. Having trouble with the former.
(In reply to Henri Sivonen (:hsivonen) from comment #1) > (In reply to Henri Sivonen (:hsivonen) from comment #0) > > The constructor of > > Span<char> or Span<const char> does work. > > Well, the latter works. Having trouble with the former. Well, of course it doesn't work, because the code in Span doesn't resemble the pattern needed to write into a std::string. Indeed, Microsoft's tests for gsl::span don't write. Not fixing for now, because I've encountered only a single case of having to write into an std::string via Span so far.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.