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

const complex new #48

Closed
wants to merge 0 commits into from
Closed

const complex new #48

wants to merge 0 commits into from

Conversation

burrbull
Copy link
Contributor

No description provided.

@burrbull
Copy link
Contributor Author

Is it possible to specify rust version feature gate?

@cuviper
Copy link
Member

cuviper commented Jun 4, 2019

You can use emit_rustc_version in the build script to get a cfg flag. The entire fn would have to be duplicated with and without the const qualifier.

However, do we really need const fn new? The fields are public, so Complex { re, im } should work just fine in constant expressions. (I suppose that could also argue against having new at all...)

@cuviper
Copy link
Member

cuviper commented Jul 26, 2019

I added conditional const functions in rust-num/num-rational#48, if that helps you here.

@burrbull burrbull closed this Jul 26, 2019
@burrbull
Copy link
Contributor Author

Does not work:

error[E0592]: duplicate definitions with name `new`

Accidentally close PR.

@burrbull
Copy link
Contributor Author

Sorry. All fine.

Created new #63

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

Successfully merging this pull request may close these issues.

None yet

2 participants