Commit graph

252 commits

Author SHA1 Message Date
Ognjen Ivkovic
23f292ce1c Add assignment to EmptyArray.init to prevent use before set error. 2014-02-14 00:09:50 -06:00
Ognjen Ivkovic
b21c398ca2 Fix issue 10958 - Variant fails to compile for types with sizeof == 0. 2014-02-14 00:04:22 -06:00
k-hara
1323bd4f00 fix Issue 12071 - Algebraic won't take delegate returning structure
Use `Variant` rather than `VariantN` in order to pack arguments and returned value in opCall.
2014-02-11 21:02:02 +09:00
k-hara
b391b2ec9f Convert to new alias syntax 2014-02-11 15:27:05 +09:00
k-hara
545a9450f8 fix property enforcement 2014-02-10 22:24:02 +09:00
monarch dodra
67a4ad1f69 Merge pull request #1869 from GoldMax/Issue-7069
The std.traits.ImplicitConversionTargets returns wrong result for dchar
2014-01-31 04:11:11 -08:00
GoldMax
b097805473 remove templates 2014-01-20 11:46:04 +07:00
Daniel Murphy
a656f26e9e Remove use of automatic adjacent string literal concatenation from phobos 2014-01-20 03:42:21 +11:00
GoldMax
6e7eabbd42 fix 7069 2014-01-17 14:58:52 +07:00
Johannes Pfau
a7442de743 std.variant: Adjust test for ARM
See http://d.puremagic.com/issues/show_bug.cgi?id=10879
2014-01-14 21:06:09 +01:00
monarchdodra
44fe3d88f7 Remove tabs 2014-01-08 08:37:52 +01:00
monarchdodra
fd8540072d Remove trailing white 2014-01-08 08:30:28 +01:00
Martin Nowak
05fe0ae758 fix usage of Type.prop in typeof expressions
- use Type.init.prop
2013-12-01 21:32:32 +01:00
k-hara
aa01e5cb02 fix property enforcement 2013-11-02 01:14:16 +09:00
Ognjen Ivkovic
482f938b53 Resolve merge conflict. 2013-10-26 11:47:11 -06:00
Ognjen Ivkovic
4d30a5f278 Fix issue 11361 - Variant fails to compile with delegates containing const arguments. 2013-10-26 00:32:27 -06:00
Ognjen Ivkovic
9e0563d5e0 Slightly reworded comment. 2013-10-25 20:26:22 -06:00
Ognjen Ivkovic
042f3d4282 Add unittests for issue 11360. 2013-10-25 20:24:05 -06:00
Ognjen Ivkovic
a563a920eb Changed to return uninitialized Variant when the stored function returns void. 2013-10-25 19:22:18 -06:00
Andrej Mitrovic
92c71f45f8 Merge pull request #1152 from andralex/4916
Fix Issue 4916: struct VariantN does not overload ()
2013-10-24 18:30:37 -07:00
Kapps
01b7536eb9 Fix 10961 - Assigning void[] to Variant causes compiler errors. 2013-09-03 18:24:27 -06:00
k-hara
206d6f7fe9 Add workaround to fix issue 10567
Currently VariantN does not support const objects comparison. So just add specialized opCmp member and use cast().
2013-07-10 01:33:21 +09:00
Martin Nowak
2dba41d032 fix issue 10017 2013-05-27 17:15:43 +02:00
Vladimir Panteleev
2e4dbe8623 std.variant: Fix "ditto ditto" documentation bug 2013-04-10 13:21:41 +00:00
k-hara
3eecfd2b1e fix Issue 3789 - Structs members that require non-bitwise comparison not correctly compared 2013-03-09 16:52:43 +09:00
Andrei Alexandrescu
74cd007c6f Fix issue 4921 - Synopsis code in std.variant documentation throws an assertion error
http://d.puremagic.com/issues/show_bug.cgi?id=4921
2013-02-26 12:04:07 -05:00
Andrei Alexandrescu
7b03c1eda5 issue 5310 2013-02-25 01:48:46 +02:00
Andrei Alexandrescu
27733b1cc4 issue 4916 2013-02-23 18:36:37 +02:00
jmdavis
a9bf4d4136 Make std.variant.maxSize public.
It's kind of hard to use VariantN without it.
2013-02-04 19:54:57 -08:00
k-hara
128aa9f8fc Remove remain redundant parenthesis. 2012-12-03 00:53:38 +09:00
k-hara
01df2f60be Remove redundant parenthesis for getters, and use assignment syntax for setters 2012-11-23 15:07:17 +09:00
David Nadlinger
d3d0bf0ffc Fix Issue 9043 - Crash on comparing unordered types. 2012-11-18 01:27:49 +01:00
David Nadlinger
0d05bfb615 Fix Variant comparison ops (fixes issue 7990).
Note that ptrdiff_t.min is used as a sentinel value in opCmp;
seems like this was an oversight during the 64 bit mass migration
in 8331c709.
2012-11-18 00:58:07 +01:00
David Nadlinger
464151ddc1 Removed unneeded imports. 2012-11-18 00:17:08 +01:00
alexrp
b202180295 Remove all uses of sizediff_t in favor of ptrdiff_t. 2012-10-15 04:24:09 +02:00
Andrei Alexandrescu
d94803416b Merge pull request #805 from callumenator/master
Fix for issue 8689, Variant doesn't attempt float conversion in opArithmetic
2012-09-28 06:40:36 -07:00
André Stein
f5600708b4 Changes according to 9rnsr's review. 2012-09-27 18:25:17 +02:00
André Stein
b01ef30580 Integrated 9rnsr's suggestions. 2012-09-27 17:25:49 +02:00
André Stein
69faa7ab24 Fixed comments (ouch). 2012-09-27 14:48:41 +02:00
André Stein
62223f51da Fixed auto tester errors - () forgotten in visit call. 2012-09-27 14:39:26 +02:00
André Stein
a14142d3fb Integrated first chunk of changes of Andrei's review. 2012-09-27 14:25:59 +02:00
André Stein
038813a4c8 Fix warnings, auto tester should succeed now. 2012-09-22 12:28:19 +02:00
Callum Anderson
3bd4e2a055 Add check for conversion to float in opArithmetic 2012-09-18 12:21:12 -08:00
André Stein
7469408f81 visit and tryVisit have been extended to allow at most one function with no parameters which is called in case of errors (variant doesn't hold a value or in case of tryVisit, holds a value which can't be handled by visiting functions). 2012-09-13 22:59:44 +02:00
André Stein
692916fbd9 Updated visit to allow just delegates passed using the template parameter list. 2012-09-13 22:59:44 +02:00
André Stein
8eec1a2502 New implementation of visit and tryVisit that allows visitor structs and classes as well as delegate functions to be passed as parameters.
tryVisit is a new function which doesn't statically ensures that all types are handled by the visiting
functions. A VariantException is thrown if the algebraic holds a value which isn't handled by
the visitors.

visit and tryVisit share a common private template function as backend which does all the magic. applyDelegate and
applyVisitor have practically been merged into one new function.
2012-09-13 22:59:44 +02:00
André Stein
05cb2c08a2 std.variant: Added more explicit template constraint to applyDelegate which checks for a Algebraic type.
The new constraint isAlgebraic checks for all member functions and types used from  Algebraic and makes it hard to call the applyDelegate with arbitrary types.
2012-09-13 22:59:44 +02:00
André Stein
95fcb05bfa std.variant: Updated pull request according to klickverbot's comments.
- Now compiles now on 64bit. size_t -> int cast in unittest has been the problem. Unittests and documentation has been updated.
- Updated template constraints: applyDelegates doesn't need one as the previous constraint is implicitly checked during instation. applyVisitor now has an additional template constraint to just allow Algebraic types.
- Must not compile code in unittests has been replaced by static assert and __trait(compiles) checks.
2012-09-13 22:59:44 +02:00
André Stein
7aa8d1b7d1 std.variant: applyVisitor had unnecessary template restriction. 2012-09-13 22:59:44 +02:00
André Stein
dd869b75f1 std.variant: Implement applyVisitor and applyDelegate.
applyVisitor allows to apply a visitor to the given Algebraic depending
on its held type. It works like boost::apply_visitor of Boost.Variant.
A visitor is specified as a structure
or class which implements opCall overloads for each supported type of the
Algebraic. The function statically ensures that all types are handled by the
visitor.

applyDelegate works like applyVisitor but allows to specfiy the visiting
functions as delegates or static functions. Static checks ensure that
all types are handled and only allowed delegates are passed to the function.
2012-09-13 22:59:44 +02:00