I have a working code in Ideone here that does not return a failure and my expectation was that an index of -1 in std string should crash the program. Is this a valid access index ?
#include <iostream>
using namespace std;
int main() {
string h = "hiu";
std::cout << h[h.size()] << ":" << h[-1] << std::endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire