typeparameters

package
v0.5.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Comparable

func Comparable() error

Comparable -- Go 1.18 より追加されたビルドイン制約型 comparable についてのサンプルです。

REFERENCES

func Function

func Function() error

Function -- Type Parameterを関数に適用するサンプルです.

メモ

無名関数はジェネリックに出来ない。コンパイルエラーとなる。
https://groups.google.com/g/golang-nuts/c/ulntjLeGYn4/m/e3dWOOqtAwAJ

VSCode で golang.go 拡張機能を利用している場合、カーソルを載せた際に表示される
ツールチップにはジェネリック関数の場合、具象化されたシグネチャが表示されるので便利。

REFERENCES

func NewRegister

func NewRegister() mapping.Register

NewRegister は、generics パッケージ用の lib.Register を返します.

func Struct

func Struct() error

Struct -- Type Parameterを構造体に適用するサンプルです.

メモ

無名構造体はジェネリックに出来ない。コンパイルエラーとなる。
https://groups.google.com/g/golang-nuts/c/ulntjLeGYn4/m/e3dWOOqtAwAJ

VSCode で golang.go 拡張機能を利用している場合、カーソルを載せた際に表示される
ツールチップにはジェネリックの場合、具象化されたシグネチャが表示されるので便利。

REFERENCES

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL