fmtlib 处理空字符串抛出异常,string pointer is null

template 
FMT_CONSTEXPR_CHAR_TRAITS auto write(OutputIt out, const Char* value)
-> OutputIt
{
	//添加-处理字符串空指针抛出异常
	if (!value) value = "null";

	//if (!value) {
		//FMT_THROW(format_error("string pointer is null"));
	//} else {
		auto length = std::char_traits::length(value);
		out = write(out, basic_string_view(value, length));
	//}
	return out;
}

 

BOSS

发表评论

PHP Code Snippets Powered By : XYZScripts.com