mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 06:00:35 +03:00
Minor fixes for -preview=in and targets preferring by-ref for real
Code compiled with -preview=in is currently supposed to link successfully against druntime/Phobos compiled without -preview=in. There were still a few places where -preview=in makes a difference for existing `in` params; convert them to `const [scope]`, analogous to PR #7593.
This commit is contained in:
parent
6ee10a49a7
commit
2bcc2375b6
2 changed files with 12 additions and 10 deletions
|
@ -766,7 +766,7 @@ enum Order : bool
|
||||||
* the return value, effectively avoiding dynamic allocation.
|
* the return value, effectively avoiding dynamic allocation.
|
||||||
*/
|
*/
|
||||||
char[num*2] toHexString(Order order = Order.increasing, size_t num, LetterCase letterCase = LetterCase.upper)
|
char[num*2] toHexString(Order order = Order.increasing, size_t num, LetterCase letterCase = LetterCase.upper)
|
||||||
(in ubyte[num] digest)
|
(const ubyte[num] digest)
|
||||||
{
|
{
|
||||||
|
|
||||||
char[num*2] result;
|
char[num*2] result;
|
||||||
|
|
|
@ -1093,7 +1093,7 @@ public:
|
||||||
* www.netlib.org,www.netlib.org) as algorithm TOMS478.
|
* www.netlib.org,www.netlib.org) as algorithm TOMS478.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
T findRoot(T, DF, DT)(scope DF f, in T a, in T b,
|
T findRoot(T, DF, DT)(scope DF f, const T a, const T b,
|
||||||
scope DT tolerance) //= (T a, T b) => false)
|
scope DT tolerance) //= (T a, T b) => false)
|
||||||
if (
|
if (
|
||||||
isFloatingPoint!T &&
|
isFloatingPoint!T &&
|
||||||
|
@ -1113,7 +1113,7 @@ if (
|
||||||
}
|
}
|
||||||
|
|
||||||
///ditto
|
///ditto
|
||||||
T findRoot(T, DF)(scope DF f, in T a, in T b)
|
T findRoot(T, DF)(scope DF f, const T a, const T b)
|
||||||
{
|
{
|
||||||
return findRoot(f, a, b, (T a, T b) => false);
|
return findRoot(f, a, b, (T a, T b) => false);
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1151,8 @@ T findRoot(T, DF)(scope DF f, in T a, in T b)
|
||||||
* root was found, both of the first two elements will contain the
|
* root was found, both of the first two elements will contain the
|
||||||
* root, and the second pair of elements will be 0.
|
* root, and the second pair of elements will be 0.
|
||||||
*/
|
*/
|
||||||
Tuple!(T, T, R, R) findRoot(T, R, DF, DT)(scope DF f, in T ax, in T bx, in R fax, in R fbx,
|
Tuple!(T, T, R, R) findRoot(T, R, DF, DT)(scope DF f,
|
||||||
|
const T ax, const T bx, const R fax, const R fbx,
|
||||||
scope DT tolerance) // = (T a, T b) => false)
|
scope DT tolerance) // = (T a, T b) => false)
|
||||||
if (
|
if (
|
||||||
isFloatingPoint!T &&
|
isFloatingPoint!T &&
|
||||||
|
@ -1458,13 +1459,14 @@ whileloop:
|
||||||
}
|
}
|
||||||
|
|
||||||
///ditto
|
///ditto
|
||||||
Tuple!(T, T, R, R) findRoot(T, R, DF)(scope DF f, in T ax, in T bx, in R fax, in R fbx)
|
Tuple!(T, T, R, R) findRoot(T, R, DF)(scope DF f,
|
||||||
|
const T ax, const T bx, const R fax, const R fbx)
|
||||||
{
|
{
|
||||||
return findRoot(f, ax, bx, fax, fbx, (T a, T b) => false);
|
return findRoot(f, ax, bx, fax, fbx, (T a, T b) => false);
|
||||||
}
|
}
|
||||||
|
|
||||||
///ditto
|
///ditto
|
||||||
T findRoot(T, R)(scope R delegate(T) f, in T a, in T b,
|
T findRoot(T, R)(scope R delegate(T) f, const T a, const T b,
|
||||||
scope bool delegate(T lo, T hi) tolerance = (T a, T b) => false)
|
scope bool delegate(T lo, T hi) tolerance = (T a, T b) => false)
|
||||||
{
|
{
|
||||||
return findRoot!(T, R delegate(T), bool delegate(T lo, T hi))(f, a, b, tolerance);
|
return findRoot!(T, R delegate(T), bool delegate(T lo, T hi))(f, a, b, tolerance);
|
||||||
|
@ -1725,10 +1727,10 @@ See_Also: $(LREF findRoot), $(REF isNormal, std,math)
|
||||||
Tuple!(T, "x", Unqual!(ReturnType!DF), "y", T, "error")
|
Tuple!(T, "x", Unqual!(ReturnType!DF), "y", T, "error")
|
||||||
findLocalMin(T, DF)(
|
findLocalMin(T, DF)(
|
||||||
scope DF f,
|
scope DF f,
|
||||||
in T ax,
|
const T ax,
|
||||||
in T bx,
|
const T bx,
|
||||||
in T relTolerance = sqrt(T.epsilon),
|
const T relTolerance = sqrt(T.epsilon),
|
||||||
in T absTolerance = sqrt(T.epsilon),
|
const T absTolerance = sqrt(T.epsilon),
|
||||||
)
|
)
|
||||||
if (isFloatingPoint!T
|
if (isFloatingPoint!T
|
||||||
&& __traits(compiles, {T _ = DF.init(T.init);}))
|
&& __traits(compiles, {T _ = DF.init(T.init);}))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue