![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
阿莫·西林
这个作者很懒,什么都没留下…
展开
-
实现C++异常系统的完善
自己实现对C++异常处理系统的改善。原创 2022-07-26 14:39:12 · 427 阅读 · 2 评论 -
什么是_GLIBCXX_VISIBILITY(default)
在头文件 <iostream> 里面,会看到这个东西#include <bits/c++config.h>#include <ostream>#include <istream>namespace std _GLIBCXX_VISIBILITY(default){_GLIBCXX_BEGIN_NAMESPACE_VERSION......这里的_GLIBCXX_VISIBILITY(default)是一个宏真实的样子长这样_原创 2022-03-25 15:20:15 · 1087 阅读 · 0 评论 -
关于C++字符串转数字格式问题
把字符串转成数字的时候可以使用C++的stringstream,具体用法如下:std::stringstream ss("1234");int result; ss << string;ss >> result;printf("%d", result); // 结果1234但是这样就有个问题,如果给的字符串格式有错该怎么办?例如:std::stringstream ss("12x34");int result; ss << str原创 2022-02-04 21:56:57 · 745 阅读 · 0 评论 -
C++实现int型十进制数转十六进制数
对于int型正整数可以用这种方法:// 进行数signed int value = 0;// 十六进制结果std::string result = "";// 十六进制数字表char hex_digits[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',};// 用do while可以支持对0原创 2021-09-12 12:52:06 · 6448 阅读 · 0 评论 -
获取C++字符串string数组长度
使用sizeof()进行求长度示例:sizeof(array) / sizeof(array[0]);还可以将其封装成宏定义#include <iostream>#define to_array_length(array) sizeof(array) / sizeof(array[0]);int main() { std::string array[5]; std::cout << to_array_length(array) .原创 2021-08-17 09:02:50 · 1386 阅读 · 0 评论