Mercurial > repos > public > sbplib_julia
comparison src/Grids/parameter_space.jl @ 1906:447ea06bfa07 feature/grids/parameter_spaces
Make promoting constructor for Interval an outer constructor
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 01 Feb 2025 22:48:13 +0100 |
parents | 238ef43fe92a |
children | 09c4fda8779d |
comparison
equal
deleted
inserted
replaced
1905:238ef43fe92a | 1906:447ea06bfa07 |
---|---|
25 A `ParameterSpace` representing an interval. | 25 A `ParameterSpace` representing an interval. |
26 """ | 26 """ |
27 struct Interval{T} <: ParameterSpace{1} | 27 struct Interval{T} <: ParameterSpace{1} |
28 a::T | 28 a::T |
29 b::T | 29 b::T |
30 end | |
30 | 31 |
31 function Interval(a,b) | 32 """ |
32 a, b = promote(a, b) | 33 Interval(a,b) |
33 new{typeof(a)}(a,b) | 34 |
34 end | 35 An interval with limits `a` and `b`. |
36 """ | |
37 function Interval(a,b) | |
38 a, b = promote(a, b) | |
39 Interval{typeof(a)}(a,b) | |
35 end | 40 end |
36 | 41 |
37 """ | 42 """ |
38 limits(i::Interval) | 43 limits(i::Interval) |
39 | 44 |