mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-10-29 11:24:07 +08:00
- const README: rewrite the space-saving claim per issue #5 follow-ups (constant-expression const vs #define immediates; which const qualify as constant expressions) - const README: fix the class-section diagnosis per issue #338 (overload resolution picks the const overload; the restriction only surfaces once that overload is removed) - sizeof README: virtual-inheritance result is compiler-dependent (GCC merges vbptr+vfptr -> 16, MSVC keeps them separate -> 32) #246 - static README: new section on internal linkage / access restriction with anonymous-namespace comparison #142 - 10-day practice: full problem list table + fixed day links #136 - new design_pattern/singleton/singleton_default.hpp: reusable thread-safe CRTP singleton template, compile+concurrency tested #303
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
# decltype那些事
|
||||
> 本文档由 [C++那些事网站](https://light-city.github.io/stories_things/cpp-things/decltype/) 同步生成,网站版本含多语言与更新排版。
|
||||
|
||||
# C++ decltype 类型推导
|
||||
|
||||
## 关于作者:
|
||||
|
||||
个人公众号:
|
||||
|
||||

|
||||

|
||||
|
||||
## 1.基本使用
|
||||
decltype的语法是:
|
||||
@@ -69,7 +71,7 @@ auto multiply(T x, T y)->decltype(x*y)
|
||||
}
|
||||
```
|
||||
|
||||
完整代码见:[decltype.cpp](decltype.cpp)
|
||||
完整代码见:[decltype.cpp](https://github.com/Light-City/CPlusPlusThings/tree/master/basic_content/decltype/decltype.cpp)
|
||||
|
||||
## 2.判别规则
|
||||
|
||||
@@ -135,4 +137,4 @@ decltype(Func(1)) var13=true;//const bool
|
||||
decltype(i++) var14 = i;//int i++返回右值
|
||||
```
|
||||
|
||||
学习参考:https://www.cnblogs.com/QG-whz/p/4952980.html
|
||||
学习参考:https://www.cnblogs.com/QG-whz/p/4952980.html
|
||||
Reference in New Issue
Block a user