//
// Created by william on 2021/4/16.
//
/// é»è®¤æé 彿°ï¼ data() çäº nullptr ï¼è size() çäº 0
/// å¤å¶æé 彿°: data() çäº other.data() ï¼è size() çäº other.size() ã
#include "base.h"
void stringViewTest()
{
std::wstring_view wcstr_v = L"xyzzy";
char array[3] = {'B', 'a', 'r'};
std::string_view array_v(array, std::size(array));
std::string cppstr = "Foo";
std::string_view cppstr_v(&cppstr[0], cppstr.size());
std::cout << cppstr_v << '\n'
<< array_v << '\n'
<< wcstr_v.size() << '\n';
// std::cout << wcstr_v.data() << std::endl;
std::string_view v = "Hello, world";
v = v.substr(7);
std::cout << v << '\n';
std::string_view str_view("abcd");
auto begin = str_view.begin();
auto cbegin = str_view.cbegin();
std::cout << *begin << '\n';
std::cout << *cbegin << '\n';
std::cout << std::boolalpha << (begin == cbegin) << '\n';
std::cout << std::boolalpha << (*begin == *cbegin) << '\n';
std::string str = " trim me";
std::string_view v1 = str;
v1.remove_prefix(std::min(v.find_first_not_of(" "), v.size()));
std::cout << "String: '" << str << "'\n"
<< "View : '" << v1 << "'\n";
constexpr std::basic_string_view