Commit graph

207 commits

Author SHA1 Message Date
Nick Treleaven
b1d6e9c143 Tweak Variant docs
Avoid unnecessary repetition of current symbol name.
Add LREFs where useful.
Remove fun(T...)(T args) example cited for old std.boxer module.
2016-11-07 10:43:04 +00:00
Nick Treleaven
0258383953 Cleanup visit throws docs, add VariantException LREF
Also fix redundant opening of C-style comment.
2016-11-06 19:09:37 +00:00
Nick Treleaven
5f32c11969 std.variant : Tweak tryVisit, visit docs
Parameter Handler -> Handlers.
Document inner template functions.
2016-10-27 17:36:21 +01:00
Cauterite
8b50e1359e Update variant.d 2016-08-15 21:24:24 +10:00
Cauterite
a63348d8c2 unittest for variant bug 16383 2016-08-15 21:12:15 +10:00
Cauterite
90e7fd0ab4 fix Issue 16383 - 'Algebraic visit does not match const' 2016-08-14 04:21:31 +10:00
Jack Stouffer
503e9f8cb3 Removed global core.stdc.string import from std.variant 2016-07-03 19:39:35 -04:00
Jack Stouffer
909c46251a Removed global std.exception import from std.variant 2016-07-03 19:37:41 -04:00
Jack Stouffer
6a79d1ea06 Removed global std.conv import from std.variant 2016-07-03 19:33:02 -04:00
Walter Bright
853496f7d2 std.variant: add attributes of test cases 2016-06-27 18:16:50 -07:00
Sebastian Wilzbach
ec47ac4224 Remove the WEB macro in favor of HTTP
replacement: sed 's/\$(WEB/\$(HTTP/g' -i **/*.d
2016-06-16 00:14:51 +02:00
Sebastian Wilzbach
18b8abf60a remove the deprecated wiki macros 2016-05-27 05:52:23 +02:00
Vladimir Panteleev
38a6370788 Merge pull request #4303 from wilzbach/mref_phobos
use mref macro instead of link2
2016-05-24 03:12:08 +03:00
Hackerpilot
e702b0ec99 Fix the behavior of a unit test 2016-05-23 14:04:45 -07:00
Sebastian Wilzbach
89a2dd5f11 use mref macro instead of link2 2016-05-16 03:30:08 +03:00
Jack Stouffer
f6bfee2a9c Fixed long lines in std/variant.d 2016-05-10 20:51:39 -04:00
Sebastian Wilzbach
69a3d9e59f fix static if mistakes 2016-05-07 14:38:03 +02:00
Sebastian Wilzbach
3d67cd228c style fix: space between operators 2016-04-26 22:26:20 +03:00
H. S. Teoh
2f5a8bb99c Merge pull request #4118 from MaksimZh/fix-15827
Fix Issue 15827 -  std.variant.Variant can not be initialized with some struct
2016-03-30 10:15:19 -07:00
Maksim Zholudev
f9aa6f6efc Fix Issue 15827. Avoid explicit use of parameter in delegate. 2016-03-28 11:32:34 +03:00
Dmitry Olshansky
00c5518e7e Merge pull request #4112 from MaksimZh/fix-15823
Fix Issue 15823 - allow opIndex for const std.variant.Variant
2016-03-24 22:57:41 +04:00
Maksim Zholudev
918b58ec37 Fix Issue 15823 - Allow opIndex for const Variant 2016-03-24 18:06:42 +03:00
k-hara
a86eeb1059 Merge two equivalent branches 2016-03-18 13:43:34 +09:00
k-hara
22c8065ffd fix Issue 15791 - Cannot get a stored nested struct object from Variant 2016-03-18 13:43:31 +09:00
Martin Nowak
0e95f6723a Merge remote-tracking branch 'upstream/stable' into merge_stable 2015-10-27 15:55:59 +01:00
k-hara
1df5afebe4 fix Issue 15039 - Algebraic cannot store a Typedef along with Typedef'ed type 2015-10-22 11:39:10 +09:00
Vladimir Panteleev
ca01aeeb83 Merge pull request #3708 from kinke/variant
std.variant: don't assert that target address != null if type size is 0
2015-10-18 02:09:50 +00:00
Dragos Carp
d698887729 Remove obsolete TypeTuple references
Replace following names:
std.typetuple      -> std.meta
TypeTuple          -> AliasSeq
ParameterTypeTuple -> Parameters
FieldTypeTuple     -> Fields

std.traits requires more work than search/replace and is left unchanged.
2015-10-13 20:37:44 +02:00
Martin
4e1b8dcc21 std.variant: don't assert that target address != null if type size is 0
A unittest triggers in line 1918 when testing Variant!(void[0]) with LDC
(current merge-2.068 branch).

When taking the address of a truly empty type, such as T[0], LDC always
returns a null constant; nothing is allocated on the stack.
Disabling this assert in case the target type's size is 0 should be safe,
there's no private state which could be modified by the following
assignment (it may still have side effects though) - right? ;)
2015-10-09 18:14:16 +02:00
Ryan Roden-Corrent
0057756b28 Allow Variant.visit to support const types.
Assuming that Foo.depth and Bar.depth are both const (e.g. both are just int
members), the following should compile:
-----
    int depth(in FooBar fb) {
        return fb.visit!((Foo foo) => foo.depth,
                         (Bar bar) => bar.depth);
    }
-----

However, it was failing with:
std/variant.d(2246): Error: cannot implicitly convert expression (variant.peek())
of type const(Foo)* to Foo*
std/variant.d(2246): Error: cannot implicitly convert expression (variant.peek())
of type const(Bar)* to Bar*

This patch changes an explicit `T*` declaration to an `auto` declaration so
const types can be visited.
2015-08-11 22:21:38 -04:00
Robert burner Schadek
971a76d941 std.variant housekeeping
variant hat some code disabled due to compiler bugs.
Some of these bugs have been fixed.
This re-enables this dead code.

removed some old code

bug remove reverse
2015-07-24 14:46:56 +02:00
Andrei Alexandrescu
120cbc2959 Replace D_PARAM with D through variant.d 2015-06-08 10:55:04 -07:00
Andrei Alexandrescu
5f0a1a6751 Add ReplaceType, use it in Algebraic. Also add get!k to Variant. 2015-06-08 10:52:11 -07:00
Rainer Schuetze
adab223837 remove trailing whitespace, detab, tolf 2015-05-31 11:24:01 +02:00
Robert burner Schadek
ee6c1a2ca8 variant: alias syntax update 2015-05-28 19:15:35 +02:00
anonymous
ca9e097abd do a reinterpret cast
opCast implementations may be incompatible, especially with inout. And
really, reinterpreting is the goal here.
2015-05-20 17:19:32 +02:00
anonymous
bb23cdd2eb inout 2015-05-15 19:55:07 +02:00
anonymous
095770983f fix issue 14586 - can't get an immutable value from a const std.variant.Variant 2015-05-15 15:35:57 +02:00
anonymous
15712f6e6c fix issue 14585 - destructor called on garbage in std.variant 2015-05-15 15:35:51 +02:00
Walter Bright
d9a9826e55 Revert "Introducing std.meta package" 2015-05-06 14:36:45 -07:00
Dicebot
7970fcc748 Don't use fqn for any/all
In most cases it resolves unambiguosly
2015-05-05 22:22:11 +03:00
Dicebot
a76d90c927 Phobos should only mention tuple as std.typecons.Tuple 2015-05-05 22:22:11 +03:00
Dicebot
1c9ae027ef Rename old std.typetuple symbols inside Phobos
staticIndexOf -> indexOf
allSatisfy -> all
anySatisfy -> any
staticMap -> Map
2015-05-05 22:22:11 +03:00
Dicebot
82f54a38d3 TypeTuple -> MetaList inside Phobos 2015-05-05 22:22:11 +03:00
Dicebot
73f773838d import std.typetuple -> import std.meta 2015-05-05 22:22:10 +03:00
Steven Schveighoffer
9ec468ee32 Merge pull request #3227 from aG0aep6G/13534
remove "@trusted:" from std.variant
2015-04-27 07:49:36 -04:00
anonymous
38a29b2d56 remove "@trusted:" from std.variant
It's too broad.

This fixes issue 13534 - std.variant can violate memory safety.
2015-04-25 21:20:35 +02:00
Justin Whear
e813450c22 Tabs to spaces 2015-04-21 12:00:45 -07:00
Justin Whear
e07a72151b minor style: change Tsize to tsize 2015-04-21 09:30:38 -07:00
Justin Whear
cb32577275 Add algebraic subset constructor
Allows construction from an algrebraic subset of types, leveraging
similar opAssign.
2015-04-21 09:30:08 -07:00