草庐IT

c++ - isalpha(<mychar>) == true 计算结果为 false?

stringtemp等于来self的调试器的“ZERO:\t.WORD\t1”。(我文件的第一行)stringtemp=RemoveWhiteSpace(data);inti=0;if(temp.length()>0&&isalpha(temp[0]))cout0&&isalpha(temp[0])==true)cout这是我的代码,用于检查temp的第一个字符是否为a-z、A-Z。第一个if语句将评估为true,第二个if语句将评估为false。为什么?!?!?!即使没有“temp.length()>0&&”,我也试过了,它仍然评估为false。它只是讨厌“==true”。我唯一能想

c++ - 传递的STL容器会生成拷贝吗?

我不记得传递STL容器是否会生成容器的拷贝,或者只是另一个别名。如果我有几个容器:std::unordered_map_hashStuff;std::vector_characterStuff;我想将这些变量传递给一个函数,我可以这样创建函数吗:voidSomeClass::someFunction(std::vectorcharacterStuff);或者这会复制unordered_map/vector吗?我想我可能需要使用shared_ptr。voidSomeClass::someFunction(std::shared_ptr>characterStuff);