imcoding 代码泛型求助 #237
-
|
不太知道怎么改了 |
Beta Was this translation helpful? Give feedback.
Answered by
xiegudong45
Jan 12, 2023
Replies: 2 comments
-
|
能力补充应该卸载函数名后面的中,我的理解是get_with_default的是一个“入参”,只有这里定义了范型后面入参 & 函数体中才能使用范型~ |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Demian101
-
|
use Std::Vector; struct Option has drop { public fun get_with_default<T: drop+copy>(t: &Option, default: T): T { 过了,感谢大佬 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


能力补充应该卸载函数名后面的中,我的理解是get_with_default的是一个“入参”,只有这里定义了范型后面入参 & 函数体中才能使用范型~