forked from dlang/phobos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangelog.dd
More file actions
134 lines (113 loc) · 4.45 KB
/
changelog.dd
File metadata and controls
134 lines (113 loc) · 4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Ddoc
$(COMMENT Pending changelog for 2.073. This will get copied to dlang.org and
cleared when master gets merged into stable.
)
$(BUGSTITLE Library Changes,
$(LI $(RELATIVE_LINK2 promoted, Added `std.traits.Promoted` to get the result of
$(LINK2 $(ROOT_DIR)spec/type.html#integer-promotions, scalar type promotion)
in multi-term arithmetic expressions.))
$(LI $(RELATIVE_LINK2 staticIsSorted, Added `std.meta.staticIsSorted` to check if
an `AliasSeq` is sorted according to some template predicate.))
$(LI $(RELATIVE_LINK2 minIndex, Added `std.algorithm.searching.minIndex`
to get the index of the minimum element of a range.))
$(LI $(RELATIVE_LINK2 maxIndex, Added `std.algorithm.searching.maxIndex`
to get the index of the maximum element of a range.))
$(LI $(RELATIVE_LINK2 ndslice-removal, `std.experimental.ndslice`
has been deprecated.))
$(LI $(RELATIVE_LINK2 has-function-attributes, Added `std.traits.hasFunctionAttributes`
as a user-friendly way to query for function attributes.))
$(LI $(RELATIVE_LINK2 bitwise, Added `std.range.bitwise` to create
a bitwise adapter over an integral type range, consuming the range elements
bit by bit.))
)
$(BUGSTITLE Library Changes,
$(LI $(LNAME2 promoted, `std.traits.Promoted` gets the type to which a scalar type will
be promoted in multi-term arithmetic expressions.)
-------
import std.traits : Promoted;
static assert(is(typeof(ubyte(3) * ubyte(5)) == Promoted!ubyte));
static assert(is(Promoted!ubyte == int));
-------
$(P See the D specification on $(LINK2 $(ROOT_DIR)spec/type.html#integer-promotions,
scalar type promotions) for more information.)
)
$(LI $(LNAME2 staticIsSorted, `std.meta.staticIsSorted` checks whether an `AliasSeq` is
sorted according to some template predicate.)
------
enum Comp(T1, T2) = T1.sizeof < T2.sizeof;
import std.meta : staticIsSorted;
static assert( staticIsSorted!(Comp, byte, uint, double));
static assert(!staticIsSorted!(Comp, bool, long, dchar));
------
$(P Additionally, the compile-time performance of `std.meta.staticSort` has been
greatly improved. Nevertheless, due to compiler limitations it is still an
extraordinarily expensive operation to perform on longer sequences; strive to
minimize such use.)
)
$(LI $(LNAME2 minIndex, `std.algorithm.searching.minIndex` gets the index of
the minimum element of a range, according to a specified predicate. The
default predicate is "a < b")
-------
import std.algorithm.searching : minIndex;
int[] a = [5, 4, 2, 1, 9, 10];
assert(a.minIndex == 3);
int[] a;
assert(a.minIndex == -1);
-------
)
$(LI $(LNAME2 maxIndex, `std.algorithm.searching.maxIndex` gets the index of
the maximum element of a range, according to a specified predicate. The
default predicate is "a > b")
-------
import std.algorithm.searching : maxIndex;
int[] a = [5, 4, 2, 1, 9, 10];
assert(a.minIndex == 5);
int[] a;
assert(a.minIndex == -1);
-------
)
$(LI $(LNAME2 ndslice-removal, `std.experimental.ndslice` has been
deprecated.)
The synchronization between Phobos and Mir turned out to be a lot of work
with litte gain. Users of `std.experimental.ndslice` are advised to
switch to the upstream $(LINK2 https://github.com/libmir/mir-algorithm,
mir package).
)
$(LI $(LNAME2 has-function-attributes, `std.traits.hasFunctionAttributes` has
been added)
It exposes a user-friendly way to query for function attributes:
-------
import std.traits : hasFunctionAttributes;
// manually annotated function
real func(real x) pure nothrow @safe
{
return x;
}
static assert(hasFunctionAttributes!(func, "@safe", "pure"));
static assert(!hasFunctionAttributes!(func, "@trusted"));
// for templated function types are automatically inferred
bool myFunc(T)(T b)
{
return !b;
}
static assert(hasFunctionAttributes!(myFunc!bool, "@safe", "pure", "@nogc", "nothrow"));
static assert(!hasFunctionAttributes!(myFunc!bool, "shared"));
-------
)
$(LI $(LNAME2 bitwise, `std.range.bitwise` creates a bit by bit adapter
over an integral type range.)
-------
import std.range : bitwise;
ubyte[] arr = [3, 9];
auto r = arr.bitwise;
r[2] = 1;
assert(arr[0] == 7);
-------
)
)
Macros:
TITLE=Change Log
BUGSTITLE = <div class="bugsfixed">$(H4 $1) $(OL $2 )</div>
RELATIVE_LINK2=<a href="#$1">$+</a>
LNAME2=<a class="anchor" title="Permalink to this section" id="$1" href="#$1">$+</a>
BOOKTABLE = <table><caption>$1</caption>$+</table>