minivariant 2.0.0
A minimal D library to expose a minimalistic tagged union
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Minivariant: Simple, focused variant library
Goal
Minivariant provides a simple way to work with a tagged union.
It aims to provide a replacement for std.variant.Algebraic, which is built on top of std.variant.Variant.
The issue that spawned this effort was the inability of Algebraic to work with basic type conversion,
e.g. it triggers a static assertion failure to assign an immutable int to an Algebraic containing an int.
Overview
The main type is minivariant.variant.Variant. It takes a tuple of accepted parameters:
auto my_variant = Variant!(uint, char, bool, string)("Hello world");
It provides a pedestrian usage, via isType and peek, and a more structured approach via visit.
- 2.0.0 released 7 years ago
- Geod24/minivariant
- MIT
- Copyright © 2018, Mathias 'Geod24' Lang
- Authors:
- Dependencies:
- none
- Versions:
-
Show all 5 versions2.0.1 2019-Jan-18 2.0.0 2018-Dec-20 1.0.1 2018-Aug-07 1.0.0 2018-May-03 ~v2.x.x 2024-Feb-08 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
3 downloads this month
-
16 downloads total
-
- Score:
- 0.7
- Short URL:
- minivariant.dub.pm