Rust part23
- 157 :デフォルトの名無しさん:2024/02/27(火) 23:58:10.03 ID:cJjIIFX3.net
- Derefは*
Deref coercionは&**
前者は明示が必要な点が違い
x: &Box<T> とすると
*x: Box<T> (by Deref &T→T)
**x: T (by Deref Box<T>→T)
&**x: &T (xのDeref coercion結果)
x: &Vec<T> とすると
*x: Vec<T> (by Deref &T→T)
**x: [T] (by Deref Vec<T>→[T])
&**x: &[T] (xのDeref coercion結果)
x: &String とすると
*x: String (by Deref &T→T)
**x: str (by Deref String→str)
&**x: &str (xのDeref coercion結果)
217 KB
新着レスの表示
掲示板に戻る
全部
前100
次100
最新50
read.cgi ver 2014.07.20.01.SC 2014/07/20 D ★