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

Convert from StepRangeLen to StepRange #57521

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Feb 24, 2025

Currently, one may convert from a StepRangeLen to a StepRange by using the fully parameterized constructor:

julia> r = StepRangeLen(3, 1, 4)
3:1:6

julia> StepRange{Int,Int}(r)
3:1:6

This PR adds a few other constructors that have fewer parameters specified. These parameters may be derived from the argument. After this PR, the following work:

julia> StepRange(r)
3:1:6

julia> StepRange{Int32}(r)
3:1:6

julia> StepRange{Int32}(r) |> typeof
StepRange{Int32, Int64}

@jishnub jishnub added the ranges Everything AbstractRange label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ranges Everything AbstractRange
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant