dvector 0.0.3
Simple dynamic array implementation for D (-betterC).
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:
dvector
Simple dynamic array implementation for D that fits my needs.
- compatible with betterC.
- compatible with std.range (with empty, front, back, popFront, popBack, save)
Example:
import core.stdc.stdlib;
import core.stdc.stdio;
import dvector;
struct Person {
string name;
uint score;
}
extern (C) int main() nothrow @nogc
{
Dvector!(Person) prs1;
auto p1 = Person("ferhat", 5);
auto p2 = Person("Mike", 3);
auto p3 = Person("Rajneesh", 1);
auto p4 = Person("Ce", 2);
prs1 ~= p1;
prs1 ~= p2;
prs1 ~= p3;
prs1 ~= p4;
Dvector!(Person) prs2;
auto s1 = Person("Ezgi", 15);
auto s2 = Person("Emine", 36);
prs2 ~= s1;
prs2 ~= s2;
auto comb = prs1 ~ prs2;
comb.remove(2);
assert(comb[2].name == "Ce");
auto cn = Person("Chuck", 100);
comb.pushFront(cn);
assert(comb[0].name == "Chuck");
auto srv = Person("SRV", 100);
comb.insert(srv, 3);
assert(comb[3].name == "SRV");
foreach(i, p; comb){
printf("%d: %s \n", i, p.name.ptr);
}
comb.free;
prs2.free;
return 0;
}
- Registered by Ferhat Kurtulmuş
- 0.0.3 released 4 years ago
- aferust/dvector
- Boost
- Copyright 2019, Ferhat Kurtulmuş
- Authors:
- Dependencies:
- none
- Versions:
-
0.0.5 2020-Mar-20 0.0.4 2020-Feb-25 0.0.3 2020-Feb-11 0.0.2 2019-Nov-12 0.0.1 2019-Sep-01 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
5 downloads this month
-
578 downloads total
-
- Score:
- 1.6
- Short URL:
- dvector.dub.pm