Skip to content

Commit

Permalink
173
Browse files Browse the repository at this point in the history
* fix #155
* fix #145
  • Loading branch information
wanghenshui authored Nov 23, 2024
1 parent 455c3e6 commit 1708e52
Show file tree
Hide file tree
Showing 4 changed files with 676 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RSS使用仓库的release RSS [链接](https://github.com/wanghenshui/cppweeklyn
## 2024


| [171](./posts/171.md) | [172](./posts/172.md) | | | | | | | | |
| [171](./posts/171.md) | [172](./posts/172.md) | [173](./posts/173.md) | | | | | | | |
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
| [161](./posts/161.md) | [162](./posts/162.md) | [163](./posts/163.md) | [164](./posts/164.md) | [165](./posts/165.md) | [166](./posts/166.md) | [167](./posts/167.md) | [168](./posts/168.md) | [169](./posts/169.md) | [170](./posts/170.md) |
| [151](./posts/151.md) | [152](./posts/152.md) | [153](./posts/153.md) | [154](./posts/154.md) | [155](./posts/155.md) | [156](./posts/156.md) | [157](./posts/157.md) | [158](./posts/158.md) | [159](./posts/159.md) | [160](./posts/160.md) |
Expand Down
4 changes: 3 additions & 1 deletion posts/115.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ auto d = map.find<return_value_or_zero>(key); // Value
```
**优化insert**

insert可能不成功,所以需要推迟value构造
insert可能不成功,所以需要推迟value构造,惰性构造

```cpp
template <class F>
Expand All @@ -287,6 +287,8 @@ auto [iter, success] = map.try_emplace(key, LAZY(acquire_value()));

这个思路还是很有用的

有提案 [P3288 std::elide](http://www.virjacode.com/papers/p3288r1.htm) 不知道有没有机会合入,代码还是很简单的 https://godbolt.org/z/rd5qbfE7E

- [Don’t name your header file security.h either](https://devblogs.microsoft.com/oldnewthing/20230524-00/?p=108239)

windows总是有这种稀奇古怪的错误,类似的有 [shouldn’t name your DLL “security.dll](https://devblogs.microsoft.com/oldnewthing/20040702-00/?p=38583)
Expand Down
2 changes: 2 additions & 0 deletions posts/158.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ operator new(sizeof(T), type_identity<T>{}, args…)

帮你把optional variant any里的T掏出来。这个很干净

就是一个惰性延迟wrapper

[实现godbolt](https://godbolt.org/z/65fEd3axf)

- [A Relocating Swap](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3239r0.pdf)
Expand Down
Loading

0 comments on commit 1708e52

Please sign in to comment.