std::string_view
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
std::string_view është një „dritare“ mbi një tekst që ekziston diku tjetër — s'e kopjon, vetëm e shikon. E bën të shpejtë kalimin e tekstit në funksione, por kujdes: teksti origjinal duhet të ekzistojë sa kohë e përdor dritaren.
EnglishEN
std::string_view is a “window” onto text that lives somewhere else — it doesn't copy it, just looks at it. It makes passing text to functions fast, but careful: the original text must still exist while you use the view.
Si ta mendosh
Si ta lexosh një libër në bibliotekë pa e fotokopjuar — shpejt dhe pa letër, por libri duhet të jetë aty.
Lexoje në anglisht
Like reading a library book without photocopying it — fast and paper-free, but the book has to be there.
Shembull kodicpp
void shfaq(std::string_view tekst) {
std::cout << tekst.substr(0, 4) << "\n";
}
shfaq("Prishtina"); // Pris