Skip to content

Instantly share code, notes, and snippets.

@es-kumagai
Created February 24, 2023 10:01
Show Gist options
  • Save es-kumagai/3806ee5a5881be113cbbb8c8b328f8ba to your computer and use it in GitHub Desktop.
Save es-kumagai/3806ee5a5881be113cbbb8c8b328f8ba to your computer and use it in GitHub Desktop.
@lococo85327937 同じように型パラメーターを扱えるものとして、総称関数。このコード例の最初の A であればたしかに「総称関数」として納得感があるのですけれど、じゃあ B は?となると疑問が出てきて、自分が間違ってた感が窺えてきます。 #CodePiece
// A. 総称関数
func action<Value: P>(_ value: Value) {
}
// B. これは、総称関数?
func action(_ value: P) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment