#include #include #include static size_t touch_string(std::string_view &in_str_view) { return in_str_view.size(); // Break here to look at bad string view. } int main() { std::wstring_view wempty(L""); std::wstring_view s(L"hello world! מזל טוב!"); std::wstring_view S(L"!!!!"); std::string_view empty(""); std::string q_source = "hello world"; std::string_view q(q_source); std::string_view Q("quite a long std::strin with lots of info inside it"); std::string_view TheVeryLongOne( "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "9012345678901234567890123456789012345678901234567890someText123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012" "345678901234567890123456789012345678901234567890123456789012345678901234" "567890123456789012345678901234567890123456789012345678901234567890123456" "789012345678901234567890123456789012345678901234567890123456789012345678" "901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890"); std::string_view IHaveEmbeddedZeros("a\0b\0c\0d", 7); std::wstring_view IHaveEmbeddedZerosToo( L"hello world!\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監", 38); std::u16string_view u16_string(u"ß水氶"); std::u16string_view u16_empty(u""); std::u32string_view u32_string(U"🍄🍅🍆🍌"); std::u32string_view u32_empty(U""); std::string_view *null_str = nullptr; std::string hello = "Hellooo "; q_source[0] = 'H'; // Set break point at this line. std::string_view *not_a_string_view = nullptr; touch_string(*not_a_string_view); return 0; }