Minimal Reproducible example:
using namespace std;
#include<string>
#include<string_view>
#include<iostream>
int main()
{
string s = "someString";
string_view sV = string_view(s);
string_view sVTwo = string_view(begin(s), end(s));
return 0;
}
Is the time complexity of creating the string_view sV linear relative to the number of chars in the string s or is it irrelevant how long the string s is? Likewise, is the time complexity of the construction of sVTwo linear or constant depending on how many chars are in the string?
The reason I am confused is I cannot tell which of these constructors here: https://en.cppreference.com/w/cpp/string/basic_string_view/basic_string_view is being used to construct the string.