Sönke Ludwig
ab25b89fb1
Make self-referential types work with TaggedAlgebraic, too.
...
Also removes some unused template code.
2019-02-22 19:28:09 +01:00
Leonid Kramer
2b83618119
Merge pull request #23 from s-ludwig/self_referential_types
...
Add support for self-referential types using "This" placeholder.
2019-02-22 17:47:41 +01:00
Sönke Ludwig
f4b621963c
Add support for self-referential types using "This" placeholder.
2019-02-22 17:34:08 +01:00
Leonid Kramer
3fc701edba
Merge pull request #22 from s-ludwig/union_api_refactor
...
Refactor the TaggedUnion API.
2019-02-22 16:37:48 +01:00
Sönke Ludwig
7ede6bf033
Refactor the TaggedUnion API.
...
- Add constructors and assignment operators for unique types
- Rename field getters to fooValue and value!() to enable sane property syntax and to avoid confusion when modifying the returned reference
- Fix misnomer "isUnionType" instead of "isUnitType"
2019-02-22 16:11:21 +01:00
Leonid Kramer
d7639cdd54
Merge pull request #20 from s-ludwig/taggedunion
...
Implement TaggedUnion and corresponding visit/tryVisit support
2019-02-22 14:43:46 +01:00
Sönke Ludwig
1c88c3c65d
Add template constraint to visit/tryVisit.
2019-02-22 12:22:38 +01:00
Sönke Ludwig
2d9557dc21
Update README.
...
Adds a TaggedUnion example and adds a section for supported compiler versions.
2019-02-22 11:30:31 +01:00
Sönke Ludwig
59826ad719
Error out on extraneous visitors.
2019-02-22 11:14:56 +01:00
Sönke Ludwig
194e0dca41
Implement a simple version of visit/tryVisit for TaggedUnion.
...
See #3 .
2019-02-22 03:08:55 +01:00
Sönke Ludwig
88308fcba4
Split up TaggedUnion and TaggedAlgebraic into separate modules.
2019-02-22 03:08:55 +01:00
Sönke Ludwig
eb8accd63c
Test on the latest compiler versions and drop support for DMD 2.074.1 and below.
2019-02-22 03:08:55 +01:00
Sönke Ludwig
f7a03cdb02
Add enum support to TaggedUnion.
...
Allows to define the accepted types using an annotated enum instead of a struct/union.
2019-02-22 03:08:55 +01:00
Sönke Ludwig
39ebd11570
Use AliasSeq instead of TypeTuple.
2019-02-22 03:08:54 +01:00
Sönke Ludwig
78ca6e0cb5
Reduce reliance on typeof(U.field) to prepare for supporting U==enum.
2019-02-22 03:08:54 +01:00
Sönke Ludwig
95c2919d2b
Introduce TaggedUnion as the low-level basis for TaggedAlgebraic.
...
TaggedUnion has a number of convenience features compared to TaggedAlgebraic that are possible because of the missing dynamic dispatch functionality. If the latter is not required, TaggedUnion provides a much less complex and more robust way to store a fixed set of types/kinds.
2019-02-22 03:08:54 +01:00
Sönke Ludwig
b78003531e
Merge pull request #21 from s-ludwig/issue_18_opbinary_ambiguity
...
Don't define ambiguous opBinary/opBinaryRight overloads
2019-02-22 03:07:41 +01:00
Sönke Ludwig
8ee1afd7f2
Don't define ambiguous opBinary/opBinaryRight overloads. Fixes #18 .
2019-02-22 03:02:50 +01:00
Sönke Ludwig
a61edbea4a
Merge pull request #17 from s-ludwig/nogc_get
...
Make get!T nogc.
2018-10-22 23:59:37 +02:00
Sönke Ludwig
6a08e1fea4
Make get!T nogc.
2018-10-21 21:37:46 +02:00
Sönke Ludwig
c275902b78
Fix deprecation warning.
2018-10-06 10:38:32 +02:00
Sönke Ludwig
debe058a7b
Merge pull request #16 from drug007/patch-1
...
String literal reduces memory allocation.
2018-09-30 10:15:42 +02:00
drug007
2d3df68333
String literal reduces memory allocation.
...
`-profile=gc` showed that `assert` allocated memory for every iteration.
2018-09-20 10:32:25 +03:00
Sönke Ludwig
f963694522
Work around linker error for "dub test" in dependent projects.
2018-03-20 17:28:21 +01:00
Sönke Ludwig
fbdc8583b7
Update compiler test list.
...
Tests on DMD 2.079.0 and LDC 1.8.0 and drops DMD <2.071.x.
2018-03-20 16:58:08 +01:00
Sönke Ludwig
2a7bd18695
Allow TA(val, kind) construction for unique types, too.
2018-03-20 16:37:52 +01:00
Sönke Ludwig
5fc3e16a83
Enable opEquals between two TaggedAlgebraic!T values.
2018-03-20 16:33:13 +01:00
Sönke Ludwig
c7f4533d17
Fix compilation errors caused by swap().
2018-03-20 16:21:36 +01:00
Sönke Ludwig
100714d7b8
Add .gitignore.
2018-01-18 00:53:16 +01:00
Sönke Ludwig
445f1ef365
Fix test for frontend versions < 2.072.x.
2018-01-18 00:44:33 +01:00
Sönke Ludwig
3709a2298f
Add test and close #8 .
...
Was fixed by 513729bf59
for compiler frontend versions >= 2.072.x.
2018-01-18 00:31:00 +01:00
Sönke Ludwig
9b13f08a25
Fix compile error for overloaded TaggedAlgebraic returns. Fixes #13 .
2018-01-18 00:29:16 +01:00
Sönke Ludwig
4438b542b2
Merge pull request #14 from s-ludwig/codecov
...
Switch to codecov.io
2018-01-18 00:10:28 +01:00
Sönke Ludwig
f9c7d444e6
Disable TypeOf on frontent versions < 2.072.x
2018-01-18 00:06:06 +01:00
Sönke Ludwig
f6e90bb0c9
Switch to codecov.io.
2018-01-18 00:02:06 +01:00
Sönke Ludwig
a80b42bcc1
Test on DMD 2.078.0 and LDC 1.7.0.
2018-01-17 23:55:17 +01:00
Sönke Ludwig
f87b378cf3
Add the TypeOf template.
2018-01-17 23:53:57 +01:00
Sönke Ludwig
de7df6bfeb
Fix hasType!T when called with rvalues.
2017-12-07 20:41:06 +01:00
Sönke Ludwig
47800db273
Test DMD 2.077.1 and LDC 1.6.0.
2017-12-07 20:30:07 +01:00
Sönke Ludwig
8e40777f0e
Merge pull request #12 from John-Colvin/fix_casting_assocArray
...
Fix casting assoc array
2017-12-07 20:18:48 +01:00
John Colvin
ffe296a96f
do implicit casting without std.conv.to
2017-12-07 15:59:12 +00:00
Sönke Ludwig
513729bf59
Enable proper default initialization.
...
Since @disable this() still leaves an invalid .init open, TaggedAlgebraic.init has now been changed to always contain the .init value of the first specified sub type.
Note that this change is restricted to DMD 2.072 and up, because earlier versions of DMD do not allow postblits or destructors within unions and using a union appears to be the only way to implement this.
2017-06-12 21:12:42 +02:00
Sönke Ludwig
b4a4b3617b
Generate coverage information for the latest DMD release.
2017-06-12 21:11:43 +02:00
Sönke Ludwig
a7c77bba94
Fix compile error on DMD 2.068.2.
2017-06-12 21:06:55 +02:00
Sönke Ludwig
67a0463fa0
Test on all current compiler versions.
2017-06-12 20:47:15 +02:00
Sönke Ludwig
be4a93e553
Make apply() work for plain values, too.
...
This provides symmetry between TaggedAlgebraic values and ordinary values.
2017-05-28 22:28:39 +02:00
Sönke Ludwig
50e80dc0d9
Add apply() to generically extract the contained value.
...
See also #3 .
2017-05-28 22:05:19 +02:00
Sönke Ludwig
e4c5ec700a
Add non-ref overload of get().
2016-11-22 18:02:34 +01:00
Sönke Ludwig
4a506f458b
Make TaggedAlgebraic.Union public.
2016-11-21 20:21:23 +01:00
Sönke Ludwig
537f17f71a
Add assertion error message.
2016-11-21 20:20:14 +01:00