C++
C++
ltimaginea
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++ 栈展开
C++ 栈展开原创 2025-01-25 14:25:39 · 410 阅读 · 0 评论 -
注意string实现的多样性
注意string实现的多样性原创 2023-05-21 23:08:25 · 200 阅读 · 0 评论 -
gcc c++标准库源码位置
gcc c++标准库源码位置原创 2022-12-22 16:42:43 · 659 阅读 · 0 评论 -
使用 Visual Studio 2022 开发 Linux C++ 应用程序
使用 Visual Studio 2022 开发 Linux C++ 应用程序原创 2021-11-18 14:12:08 · 12524 阅读 · 0 评论 -
Visual Studio 2022 使用监视窗口查看变量的地址
Visual Studio 2022 使用监视窗口查看变量的地址原创 2022-08-13 15:47:50 · 6136 阅读 · 0 评论 -
Visual Studio 2022 额外指定编译命令
Visual Studio 2022 额外指定编译命令原创 2022-08-12 22:04:43 · 1889 阅读 · 0 评论 -
PreventSlicing_VirtualClone
C++Coding Standards:101 Rules,Guidelines,and Best Practices 第54条原创 2022-04-30 13:05:43 · 460 阅读 · 0 评论 -
C++ Most Vexing Parse
Effective STL Item06 C++'s Most Vexing Parse原创 2022-02-17 22:42:08 · 479 阅读 · 1 评论 -
GDB commands
原创 2022-01-07 21:35:19 · 501 阅读 · 0 评论 -
unique_ptr 拷贝的方法
unique_ptr 拷贝的方法std::unique_ptr Deep Copy虽然 std::unique_ptr 删除了 copy constructor 和 copy assignment operator ,但其实我们可以借助移动操作变通地对 std::unique_ptr 进行拷贝。deep copy 示例如下:std::unique_ptr<std::string> up1(std::make_unique<std::string>("Good morning"原创 2022-01-07 18:00:54 · 3790 阅读 · 0 评论 -
C++ 静态局部变量 全局变量
C++ 静态局部变量 全局变量Static local variable and Global variableStatic local variable对于 static local variable ,在 control 首次经过其声明时才会被初始化(除非其初始化是零初始化或常量初始化,这可以在首次进入块前进行),在其后所有的调用中,声明均被跳过,在程序结束时其才会被销毁。C++11起,static local variable 的初始化是线程安全的,C++11标准保证:如果多个线程试图同时初始原创 2022-01-05 18:54:54 · 1213 阅读 · 0 评论 -
Visual Studio 2022 配置CMake
Visual Studio 2022 配置CMakeBuild and Debug C++ with WSL 2 Distributions and Visual Studio 2022 - C++ Team Blog (microsoft.com)原创 2021-12-06 16:59:44 · 6333 阅读 · 0 评论 -
C++ 单例模式 Singleton
#include <iostream>#include <cassert>class Singleton{public: static Singleton& Instance() { static Singleton instance; return instance; }public: Singleton(const Singleton&) = delete; Singleton(Singleton&&) = delet原创 2021-10-12 22:57:49 · 1810 阅读 · 8 评论 -
使用 Visual Studio 2019 with WSL 基于 CMake 开发 Linux C++ 应用程序
使用 Visual Studio 2019 with WSL 基于 CMake 开发 Linux C++ 应用程序Visual Studio CMake 项目和 WSLhttps://devblogs.microsoft.com/cppblog/c-with-visual-studio-2019-and-windows-subsystem-for-linux-wsl/https://docs.microsoft.com/zh-cn/cpp/linux/cmake-linux-project?v原创 2021-11-21 18:33:31 · 1494 阅读 · 0 评论 -
使用 Visual Studio 2019 开发 Linux C++ 应用程序(四)
使用 Visual Studio 2019 开发 Linux C++ 应用程序(四)C++ 与 Visual Studio 2019 和 WSL (库组件)Reference在 C++ 项目中使用库和组件 | Microsoft Docs演练:创建和使用自己的动态链接库 (C++) | Microsoft Docs演练:创建并使用静态库 (C++) | Microsoft DocsVisual Studio 概述 | Microsoft DocsMicrosoft C/原创 2021-11-21 18:22:52 · 561 阅读 · 0 评论 -
使用 Visual Studio 2019 开发 Linux C++ 应用程序(三)
使用 Visual Studio 2019 开发 Linux C++ 应用程序(三)头文件如果不小心修改了 Linux C/C++ 标准头文件,可以下面这样操作进行恢复:项目 → 重新扫描解决方案原创 2021-11-21 18:16:05 · 536 阅读 · 0 评论 -
使用 Visual Studio 2019 开发 Linux C++ 应用程序(二)
使用 Visual Studio 2019 开发 Linux C++ 应用程序 (二)终端A more integrated terminal experience | Visual Studio Blog (microsoft.com)Say hello to the new Visual Studio terminal! | Visual Studio Blog (microsoft.com)适用于开发人员的命令行 shell 和提示 - Visual Studio | Microsoft Do原创 2021-11-21 18:10:31 · 1234 阅读 · 0 评论 -
使用 Visual Studio 2019 开发 Linux C++ 应用程序
使用 Visual Studio 2019 开发 Linux C++ 应用程序Visual Studio 使用 C++ 的 Linux 开发(WSL)https://devblogs.microsoft.com/cppblog/c-with-visual-studio-2019-and-windows-subsystem-for-linux-wsl/其大致原理是:“ Visual Studio 通过 wsl.exe 在本地执行所有命令,并依赖安装在 /mnt 文件夹(例如 /mnt/c/Users…)原创 2021-11-21 17:59:35 · 1475 阅读 · 1 评论 -
使用 Visual Studio 2022 开发 Linux C++ 应用程序(二)
使用 Visual Studio 2022 开发 Linux C++ 应用程序Build and Debug C++ with WSL 2 Distributions and Visual Studio 2022ReferencesBuild and Debug C++ with WSL 2 Distributions and Visual Studio 2022 - C++ Team Blog (microsoft.com)Visual Studio 2022 引入了用于 C++ 开发的本原创 2021-11-21 17:46:36 · 1869 阅读 · 0 评论 -
new 捕获所有异常 避免内存泄漏
new 捕获所有异常#include <iostream>#include <new>class Widget { double d[1024 * 1024 * 1024]; /* ... */ };void Foo(){ Widget* ptr1 = new Widget; try { //... // perform some operations } catch (/*...*/) // for any exception { dele原创 2021-10-29 17:39:02 · 290 阅读 · 0 评论 -
new delete
new delete原创 2021-10-28 15:38:39 · 99 阅读 · 0 评论 -
私有析构函数和删除析构函数
析构函数 destructor私有析构函数 private destructor析构函数是 private 时,那么当对象销毁时或对于动态分配的对象,当对指向它的指针应用 delete 运算符时,只有 对象销毁 所处的上下文环境为成员函数体或友元函数体内部时,才能正常调用 private 析构函数,才能正常销毁对象。其原因是,只有成员函数和友元函数才能访问类的 private 成员。所以,(1)当定义一个对象(非动态分配)时,只有 对象定义 所处的上下文环境能够访问 private 析构函数时,编译器原创 2021-10-20 17:26:14 · 567 阅读 · 0 评论 -
Google Style Guides
Google Style GuidesGoogle Style GuidesGoogle 开源项目风格指南 (zh-google-styleguide.readthedocs.io)原创 2021-10-12 21:21:10 · 213 阅读 · 0 评论 -
VS Code Just My Code Debugging
VS Code Just My Code Debugging???? VS Code for C++ doesn’t support Just My CodeRefer here:Add support for “Just My Code” debugging · Issue #5763 · microsoft/vscode-cpptools · GitHubVS Code for Java supports Just My CodeVS Code for Java supports Just M原创 2021-10-03 17:33:43 · 1072 阅读 · 0 评论 -
Just My Code debugging
Just My Code debuggingDuring a debugging session, the Modules window shows which code modules the debugger is treating as My Code (user code), along with their symbol loading status. For more information, see Get more familiar with how the debugger attach原创 2021-10-03 13:33:05 · 280 阅读 · 0 评论 -
C++ with WSL 2 Distributions and Visual Studio 2022
Build and Debug C++ with WSL 2 Distributions and Visual Studio 2022ReferencesBuild and Debug C++ with WSL 2 Distributions and Visual Studio 2022 - C++ Team Blog (microsoft.com)Visual Studio 2022 引入了用于 C++ 开发的本机 WSL 2 工具集。此工具集现已在Visual Studio 2022 版本 1原创 2021-10-03 00:18:43 · 433 阅读 · 0 评论 -
Visual Studio Debug only user code with Just My Code
Visual Studio Debug only user code with Just My CodeBy default, the debugger skips over non-user code (if you want more details, see Just My Code).Just My Code is a Visual Studio debugging feature that automatically steps over calls to system, framework,原创 2021-10-02 23:47:59 · 562 阅读 · 0 评论 -
Great books for learning C++
Great books for learning C++Here are three great books for learning C++ – whether you know C++ already or not, and whether you even know how to program in any language or not, you’ll find the book that’s right for you.原创 2021-09-26 11:30:53 · 126 阅读 · 0 评论 -
Get Mingw-w64 via MSYS2
Get Mingw-w64 via MSYS2Get the latest version of Mingw-w64 via MSYS2, which provides up-to-date native builds of GCC, Mingw-w64, and other helpful C++ tools and libraries. Click here to download the MSYS2 installer. Then follow the instructions on the MS原创 2021-09-25 12:30:19 · 274 阅读 · 0 评论 -
Using C++ in VS Code
Using C++ and WSL in VS Code???????? Get Started with C++ and Windows Subsystem for Linux in Visual Studio Code???????? Configure VS Code for Clang/LLVM on macOS (visualstudio.com)原创 2021-09-17 15:08:41 · 158 阅读 · 0 评论 -
返回值优化 RVO
《深度探索C++对象模型》—— 2.3 返回值的初始化 & 在编译器层面做优化原创 2021-09-16 20:40:36 · 147 阅读 · 0 评论 -
Rvalue References
Rvalue References原创 2021-09-10 14:34:34 · 167 阅读 · 0 评论 -
Endian
Endian寻址多字节对象被存储为连续的字节序列,对象的地址为所使用字节中最小的地址。例如,假设一个类型为 int 的变量 a 的地址为 0x100,也就是说,地址表达式 &a 的值为 0x100。那么,(假设数据类型 int 为32位表示) a 的 4 个字节将被存储在内存的 0x100、0x101、0x102 和 0x103 位置。字节顺序最低有效字节存储在起始地址,这称为小端(Little Endian)字节序;最高有效字节存储在起始地址,这称为大端(Big Endian)字节序。原创 2021-09-02 12:47:58 · 228 阅读 · 0 评论 -
endian
原创 2021-08-31 22:23:35 · 271 阅读 · 0 评论 -
g++ 常用命令
g++ --help原创 2021-08-31 16:19:45 · 232 阅读 · 0 评论 -
Boost Started on Windows
Boost 官网指南Boost C++ LibrariesBoost Getting Started on Windows - 1.77.0① 下载 Boost.7z包下载 .7z包 boost_1_77_0.7z ,解压至目录: C:\Program Files\boost\boost_1_77_0\ 。② Prepare to Use a Boost Library Binary以管理员身份运行PowerShell ,切换至 Boost 根目录 C:\Program Files\原创 2021-08-30 22:46:48 · 168 阅读 · 0 评论 -
Visual Studio 安装 C++
Visual Studio 安装 C++原创 2021-04-24 18:58:21 · 1318 阅读 · 0 评论 -
纯虚函数
原创 2020-12-13 20:30:22 · 352 阅读 · 0 评论 -
虚函数的访问权限
#include <iostream>using namespace std;class A{public: virtual void Print() { cout << "A::Print" << endl; }};class E :public A{//public: /* 即使是private,编译依然可以通过,多态时也能正确调用E::Print() */private: virtual void Print() { cout <&l原创 2020-11-30 00:29:36 · 463 阅读 · 0 评论 -
虚析构函数
C++ 内联函数#include <iostream>using namespace std;inline int Max(int a, int b){ if (a > b) return a; else return b;}int main(){ cout << Max(23, 5) << endl; return 0;}内联函数和普通函数的区别在于:当编译器处理调用内联函数的语句时,不会将该语句编译成函数调用语句的指原创 2020-11-21 00:09:43 · 160 阅读 · 0 评论
分享