Commit graph

315 commits

Author SHA1 Message Date
Vladimir Panteleev
6caa5fa19a
std.container.rbtree: Add trisect (#10756)
Useful in case we need >= or <= (instead of > or < or = as provided by
lowerBound/upperBound/equalRange).

Same convention as SortedRange.trisect, except just return a static
array instead of a tuple (as the type is the same).
2025-04-20 07:29:02 +08:00
Nick Treleaven
ea28abfadb [std.container DList docs] Fix time complexity of insertFront etc
See https://forum.dlang.org/post/vkubcdpniiseeuxvdvim@forum.dlang.org
2025-02-17 17:48:13 +01:00
Martin Kinkelin
b0ef9ac009 Merge remote-tracking branch 'origin/stable' into merge_stable 2024-11-17 01:17:07 +01:00
Nicholas Wilson
b7743abfcf
Fix bugzilla issue 24637 (#9073) 2024-10-27 17:18:41 +08:00
Vladiwostok
231ae8b68a
Fix D-Scanner linting issues (#9070)
* Fix UndocumentedDeclarationCheck linting issue

* Fix IfConstraintsIndentCheck linting issue

* Address feedback

* Fix publictests CI

* Fix old (libdparse) D-Scanner linting warn
2024-10-27 01:21:56 -07:00
Nick Treleaven
39d921681b Fix import 2023-11-06 17:50:20 +00:00
Nick Treleaven
0eaa3e25a1 Fix Issue 24151 - std.container.array: Array!string("") does not compile 2023-09-19 21:17:07 +01:00
Dennis
5cd77a6e32
User hyperlinks to refer to bugzilla issues (#8766) 2023-06-16 14:45:44 +03:00
WebFreak001
3b3757af6b
fix 22147: allow @disable this(this) T in DList!T 2023-03-12 19:49:11 +01:00
MathewColin
eb461f8e9d
Better document the use of Heaps with Dynamic Array as Store (#8677)
Better document the use of Heaps with Dynamic Array as Store

Signed-off-by: Dennis <dkorpel@users.noreply.github.com>
Merged-on-behalf-of: Dennis <dkorpel@users.noreply.github.com>
2023-02-09 13:55:44 +01:00
Lucian Danescu
322fed7bf7 add local imports 2022-11-12 19:29:28 +02:00
Per Nordlöw
ee64840397 Replace enforce(!empty with assert(!empty at the beginning of range members 2022-10-10 09:08:23 +02:00
Paul Backus
aaa0b705ec
Merge pull request #8368 from dukc/safe-ref-counted
Safe ref counted
2022-10-03 15:05:52 -04:00
Andrej Mitrovic
92a9d600d1 Fix issue 23333 - Make DList opSlice @nogc 2022-09-15 13:33:49 +02:00
Ate Eskola
490caa7090 RefCounted -> SafeRefCounted, OldRefCounted -> RefCounted. 2022-09-11 01:35:35 +03:00
Ate Eskola
bb145a09a6 Ate's work on safe ref counted 2022-09-11 01:35:35 +03:00
Martin Nowak
32733a908d Merge remote-tracking branch 'upstream/stable' into merge_stable 2022-08-30 08:12:00 +02:00
Walter Bright
5d2baa46b6 rbtree lambda references stack frame 2022-08-19 06:14:33 -07:00
RubyTheRoobster
4cbac77a8a I'm sick of my text editor adding random whitespace 2022-08-10 15:47:54 -04:00
RubyTheRoobster
7caaa7838d I have no idea why the unittest works now, but okay 2022-08-10 15:37:32 -04:00
RubyTheRoobster
e0280ae2fc Use Unshared only when necessary 2022-08-10 14:49:05 -04:00
RubyTheRoobster
ce098b99d4 Fix tests (they should still work) 2022-08-04 08:08:37 -04:00
RubyTheRoobster
4b5cfc17b9 D Style Fix (again) 2022-08-03 21:12:08 -04:00
RubyTheRoobster
9aa628a64d D Style Fix 2022-08-03 21:08:12 -04:00
RubyTheRoobster
4cfb36aece Add tests 2022-08-03 20:57:38 -04:00
RubyTheRoobster
6343d5a58d Private the Unshared alias. 2022-08-03 14:19:22 -04:00
RubyTheRoobster
15860563c7 fixup! Remove limit-violating lines to fit D style. 2022-08-03 13:46:14 -04:00
RubyTheRoobster
08ea63f4f4 Remove limit-violating lines to fit D style. 2022-08-03 13:14:38 -04:00
RubyTheRoobster
2023b271e5 Fix issue 23140 - Array!T where T is a shared class no longer works 2022-08-03 11:58:12 -04:00
dkorpel
f7c93036b3 Fix return/inout usage in rbtree 2022-02-16 16:27:04 +00:00
wolframw
dc697c8dd8 Fix Issue 22105 - std.container.array.Array.length setter creates values of init-less types 2021-12-28 23:33:31 +00:00
dkorpel
ea76f45494 Use return scope instead of just return 2021-11-26 17:03:06 +01:00
Ömer Faruk IRMAK
61d3fe3293 Add explicit default ctor for DList.PayNode
Worksaround Issue 22510 (https://issues.dlang.org/show_bug.cgi?id=22510)
which prevented us from using structs with explicit copy ctors with DList.
2021-11-14 14:50:23 +03:00
Petar Kirov
dfaaf8fa53 Merge remote-tracking branch 'upstream/stable' into merge_stable 2021-11-09 10:30:28 +02:00
MoonlightSentinel
c0981769a0 Fix 22487 - Don't access payload for unititialized array data
Explicitly return `[]` when `store` wasn't intialized yet.
2021-11-08 05:40:08 +00:00
MoonlightSentinel
a22571f59a Fix 22488 - Add inout to allow Array.data for const/immutable Array's
Simply propagate the const'ness to the return slice.
2021-11-08 05:34:08 +00:00
DoctorNoobingstoneIPresume
6b05400fba std.container.Array: Payload.reserve re-used, object leak fixed.
This is another attempt to re-use the code in `Payload.reserve` --
similar to https://github.com/dlang/phobos/pull/8143 (commit 0b7bf8dc):
"std.container.Array: Simplify implementation of length (by calling reserve).".

Additionally, `Array`'s variadic constructor is now safer:

  If `emplace`-ing an element fails, successfully `emplace`-d elements are now destroyed.

  Example:

  ```
    auto a = Array!S (S(0), S(1), S(2), S(3));

    // If emplace-ing a[2] (as a copy of S(2)) fails:
    //   - pre-existing behaviour: a[1] and a[0] were not destroyed (bad);
    //   - new behaviour:          a[1] and a[0] are      destroyed (good).
  ```

  A corresponding `unittest` has been added (`S.s_nDestroyed == S.s_nConstructed`):
    When such a failure (`Exception`) is caught, there should be no leaked objects.

  Implementation:
    Previously:
      - the `Payload` `length` used to be increased only once,
        after having successfully `emplace`-d all elements,
        thus incorrectly tracking the number of `emplace`-d elements during the loop
        (but correctly tracking it after the loop -- iff the entire loop succeeded).
    Now:
      - the `Payload` `length` is incremented multiple times,
        at each step i.e. after having successfully `emplace`-d each element,
        thus correctly tracking the number of `emplace`-d elements during the loop.
    Note:
      When the constructor fails, the corresponding destructor is not run.
      But the destructors for successfully constructed sub-objects are run;
      in this case, the destructor for the `_data` sub-object is run --
      and it is this destructor which destroys the successfully emplaced elements
      (iff they have been correctly tracked).
2021-09-27 02:23:14 +03:00
dkorpel
53cd09c1fb mark RBNode.left and RBNode.right @trusted 2021-08-09 12:29:07 +02:00
Razvan Nitu
b48cca57e8
Merge pull request #8151 from DoctorNoobingstoneIPresume/210615_std_container_array_Payload_insertBack_01h
std.container.Array: insertBack: Extra checks (including addition overflow).
2021-07-28 18:30:26 +08:00
dandrei279
11bf097658
[DSSv3] Fix Issue #21100: Add data() function to std.container.array.Array (#8174)
[DSSv3] Fix Issue #21100: Add data() function to std.container.array.Array

Signed-off-by: Max Haughton <maxhaton@users.noreply.github.com>
Merged-on-behalf-of: Max Haughton <maxhaton@users.noreply.github.com>
2021-07-21 02:23:10 +00:00
Vladimir Panteleev
9baab6030a std.container.array: Hide unintentionally-public unittest
This is a unittest for a bug, not a public example.
2021-07-05 05:40:36 +00:00
DoctorNoobingstoneIPresume
7f9cc3fbbb std.container.Array: insertBack: Extra checks (including addition overflow). 2021-06-22 19:33:33 +03:00
DoctorNoobingstoneIPresume
0b7bf8dc1f std.container.Array: Simplify implementation of length (by calling reserve). 2021-06-14 05:05:39 +00:00
nordlow
4ba167b15b Annotate std/container/dlist.d to please dlang/dmd#12520 2021-05-18 01:58:16 +02:00
DoctorNoobingstoneIPresume
afeb00d580 container.array: RangeT: moveBack: Improve an assertion. 2021-05-04 08:13:40 +02:00
Razvan Nitu
6e11524c6f
Merge pull request #7189 from burner/assert_messages_container_package
adds assert messages to std.container.package
2021-04-21 20:46:12 +08:00
Razvan Nitu
89abc75f02
Merge pull request #7745 from kinke/emplace
Get rid of std.conv.emplace[Ref](), use core[.internal].lifetime
2021-01-25 15:36:04 +08:00
Luís Ferreira
e0bbaf3649 container: array: simplify some unittests by using Array!bool ctor instead
Since ae90bc7, we can simplify unittests by using Array!bool ctor instead of
manually do .insertBack(...). This improves example code readability.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2021-01-23 07:26:39 +01:00
Razvan Nitu
d7fd00d792
Merge pull request #7752 from ljmf00/container-array-ctor-bool
container: array: add ctors for Array!bool
2021-01-22 15:30:10 +08:00
Luís Ferreira
ce558d26b1 container: array: add type checks for passed arguments in insertAfter()
insertAfter should receive a valid element or a Range of values according to
type T of the corresponding instance Array!T.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2021-01-19 03:42:45 +01:00