1

Is there any special reason that operator+ isn't defined for std::string and std::string_view? I find it's weird.

#include <iostream>
#include <cstdlib>
#include <string>

using namespace std::literals;

int main()
{
    // That's OK
    std::cout << "Hello,"s + " World!" << std::endl;
    // Here at least GCC complains 
    std::cout << "Hello, "s + " World!"sv << std::endl;
}
Elohim Meth
  • 1,777
  • 9
  • 13

0 Answers0