Steven Schveighoffer
c322e43fd4
Add access of value via Kind enum. Fixes #38 .
2019-11-30 09:30:29 -05:00
Sönke Ludwig
3d0305da16
Merge pull request #37 from schveiguy/addNullHandling
...
Allow typeof(null) to provide constructors and opAssign for TaggedUnion.
2019-11-01 09:00:47 +01:00
Steven Schveighoffer
f0d324f43f
Allow typeof(null) to provide constructors and opAssign for TaggedUnion.
...
Fixes #36 .
2019-10-30 18:12:50 -04:00
Leonid Kramer
985d50b7aa
Merge pull request #35 from s-ludwig/taggedunion_tostring
...
Add TaggedAlgebraic.toString().
2019-10-25 23:20:22 +02:00
Sönke Ludwig
b037967ed0
Add unit test.
2019-10-25 22:20:27 +02:00
Sönke Ludwig
d6d480b647
Add TaggedAlgebraic.toString().
...
Enables a better string representation, mainly useful for debugging purposes.
2019-10-25 22:16:44 +02:00
Sönke Ludwig
35058cfbc8
Merge pull request #34 from John-Colvin/fix_array_members
...
Fix non-aggregate properties
2019-10-24 21:06:17 +02:00
John Colvin
c128744e19
check sizeof
2019-10-24 17:59:04 +01:00
John Colvin
9789701e6e
fix array members
2019-10-24 17:54:00 +01:00
Sönke Ludwig
c3aa2cf750
Add API documentation links.
2019-10-11 11:20:38 +02:00
Sönke Ludwig
cde25d43bc
Merge pull request #33 from s-ludwig/issue9_bogus_hasmember_result
...
Add stronger restrictions to TA.opDispatch. Fixes #9 .
2019-10-11 11:19:43 +02:00
Sönke Ludwig
f8a9b8c651
Add stronger restrictions to TA.opDispatch. Fixes #9 .
...
Defines opDispatch as two levels of nested templates, so that the outer level only checks the member name to match any member defined by one of the contained types. This allows hasMember!TA to report proper values instead of always assuming `true`.
As a side-effect, `isOutputRange!(TA, T)` now only returns true, if any of the contained types is actually a matching output range.
2019-10-11 11:13:57 +02:00
Sönke Ludwig
152e410bdd
Merge pull request #32 from s-ludwig/upgrade_compiler_support
...
Test up to DMD 2.088.0 and LDC 1.17.0.
2019-10-11 10:45:22 +02:00
Sönke Ludwig
aa0d7c8587
Test up to DMD 2.088.0 and LDC 1.17.0.
2019-10-11 10:35:08 +02:00
Sönke Ludwig
bd26a94622
Merge pull request #31 from s-ludwig/issue_15_ref_return
...
Let all TaggedAlgebraic operations return as auto ref
2019-10-11 10:34:39 +02:00
Sönke Ludwig
f4c7030459
Let all TaggedAlgebraic operations return as auto ref. Fixes #15 .
2019-10-11 10:28:23 +02:00
Sönke Ludwig
4938007701
Merge pull request #30 from Geod24/gitignore
...
Use a more modern .gitignore
2019-06-20 12:11:18 +02:00
Geod24
defcaa7ecf
Use a more modern .gitignore
...
This repository cannot be used as a submodule because it does not ignore .a
2019-06-20 16:33:27 +09:00
Sönke Ludwig
d72ffacf9e
Fix example-
2019-04-16 12:11:14 +02:00
Sönke Ludwig
78158dbae8
Merge pull request #29 from s-ludwig/alignment_fix
...
Compute the proper struct alignment for TaggedUnion.
2019-04-16 12:02:13 +02:00
Sönke Ludwig
ba79a25298
Add explicit unit test for commonAlignment.
2019-04-16 11:49:42 +02:00
Sönke Ludwig
fd85603576
Compute the proper struct alignment for TaggedUnion.
...
Before this change, the alignment of TaggedAlgebraic was always 4, which in turn had a 50% chance of aligning 8-byte pointers on a non-8-byte boundary, causing the pointer to become invisible to the GC (and less bad, causing performance degradation when dereferencing the pointer). This would happen in particular when the total size of the TaggedUnion/TaggedAlgebraic was not divisible by 8 and an array of values was built.
2019-04-16 11:37:04 +02:00
Sönke Ludwig
bb650bd5cf
Merge pull request #28 from denizzzka/ddox_fix
...
Ddox fix, CI test added
2019-03-05 13:22:35 +01:00
Denis Feklushkin
3258572585
Ddox fix and CI test added
2019-03-05 19:04:45 +07:00
Sönke Ludwig
aa6b78783e
Merge pull request #27 from s-ludwig/detect_invalid_visitors
...
Detect types that are obviously not function literals.
2019-02-24 15:00:34 +01:00
Sönke Ludwig
141a4e290a
Detect types that are obviously not function literals.
...
This avoids extremely cryptic error messages with no pointer to the origin of the problem.
2019-02-24 14:24:37 +01:00
Sönke Ludwig
c1e3e5a6a2
Merge pull request #26 from s-ludwig/non_copyable_types
...
Fix using non-copyable types with TaggedUnion.
2019-02-24 10:53:32 +01:00
Sönke Ludwig
953198a293
Fix using non-copyable types with TaggedUnion.
2019-02-23 21:49:08 +01:00
Leonid Kramer
995c0779a9
Merge pull request #25 from s-ludwig/tagged_union_improvements
...
Tagged union improvements
2019-02-23 19:27:39 +01:00
Sönke Ludwig
7145693748
Work around name lookup issue on DMD < 2.081.0.
2019-02-23 18:18:39 +01:00
Sönke Ludwig
56d50fd56c
Work around Phobos issue 19696.
2019-02-23 18:18:22 +01:00
Sönke Ludwig
6589bac23a
Add TaggedUnion.hasType!T.
2019-02-23 16:16:20 +01:00
Sönke Ludwig
a52958ef01
Work around ReplaceType compile error issue.
...
ReplaceType doesn't work for "class C : D!C {}"
2019-02-23 15:56:59 +01:00
Sönke Ludwig
b766f62d43
Actually check for superfluous handlers.
2019-02-23 15:55:57 +01:00
Leonid Kramer
cb1b000157
Merge pull request #24 from s-ludwig/taggedalgebraic_self_referential
...
Make self-referential types work with TaggedAlgebraic, too.
2019-02-22 20:02:29 +01:00
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