You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stdlib can determine two token type are equal, it depends native method name_of .
/// Return true if the type `TokenType1` is same with `TokenType2`
public fun is_same_token<TokenType1: store, TokenType2: store>(): bool {
return token_code<TokenType1>() == token_code<TokenType2>()
}
Can support method to determine any generic type are equals ? Likes
Generic Type1 == Generic Type2 ?
The text was updated successfully, but these errors were encountered:
Using a Global Registry is one way to achieve this, like the NFT.
public fun is_same_type<T1,T2>():bool{
let type_info_1 = borrow_global<TypeInfo<T1>>();
let type_info_2 = borrow_global<TypeInfo<T2>>();
return type_info_1 == type_info_2;
}
jolestar
changed the title
Support method to determine two generic type are equal
[move]Support method to determine two generic type are equal
Mar 21, 2022
Stdlib can determine two token type are equal, it depends native method
name_of
.Can support method to determine any generic type are equals ? Likes
The text was updated successfully, but these errors were encountered: