Skip to content

Commit

Permalink
explicit typename
Browse files Browse the repository at this point in the history
  • Loading branch information
Katzeee committed Mar 24, 2024
1 parent 3e37694 commit 476fa58
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _drafts/memory-order.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> https://mp.weixin.qq.com/s/t5_Up2YZEZt1NLbvgYz9FQ +
> https://www.zhihu.com/question/24301047/answer/83422523
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
= Cpp Explicit template and typename Declaration
:revdate: 2024-03-24
:page-category: Cpp
:page-tags: [cpp]

*Compilers may hard to tell the real meaning without explicit declaration*

Misunderstanding by compiler:

```cpp
void func() {
result.emplace<0>(something); // <1>
std::decay<T>::type *a; // <2>
result.template emplace<0>(something);
typename std::decay<T>::type *a;
}
<1> the result of whether `result.emplace` is less than 0 compare with `something`
<2> `std::decay<T>::type` is a value then times `a`
```

0 comments on commit 476fa58

Please sign in to comment.