Skip to content

Update alloc_cu.cpp C++17标准 优化map_ 初始化#17

Open
SuperGoodGame wants to merge 1 commit intozjhellofss:mainfrom
SuperGoodGame:main
Open

Update alloc_cu.cpp C++17标准 优化map_ 初始化#17
SuperGoodGame wants to merge 1 commit intozjhellofss:mainfrom
SuperGoodGame:main

Conversation

@SuperGoodGame
Copy link

修改

  1. 删除了不必要的clear,减少开销
  2. 采用C++17 显示初始化map_ 中的项
    C++17 提供了 std::map::try_emplace,可以在键不存在时插入默认值,同时返回引用
    避免原有隐式初始化行为可能带来的代码易读性损失和后续插入空值的潜在影响
  3. 减少循环中初始化多余的big_buffers_map_ 项

通过所有测试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant