#include <iostream> #include <string> std::string get_string( const char* str ) { std::string result = str; return result; } int main() { std::cout << get_string( nullptr ).size() << std::endl; std::cout << " OK? " << std::endl; return 0; }実行結果
terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid Abort trap: 6
0 件のコメント:
コメントを投稿