Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation question: Option's secondary pointer #5

Open
zweix123 opened this issue Nov 11, 2024 · 1 comment
Open

Implementation question: Option's secondary pointer #5

zweix123 opened this issue Nov 11, 2024 · 1 comment

Comments

@zweix123
Copy link

I have a question, why does the implementation of Option use a second level pointer? I have reviewed the implementation of the relevant methods, can using a first level pointer also meet the requirements?

May I ask how the design was considered at that time?

@zweix123
Copy link
Author

I seem to understand a bit.

func TestZweix(t *testing.T) {
	type F struct {
		A int
		B string
	}
	opt1 := gust.Some[*F](&F{A: 1, B: "2"})
	opt2 := gust.Some[*F](nil)
}

To identify such scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant