Skip to content

Commit

Permalink
add vector parameter passing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmankoko committed Sep 10, 2024
1 parent d1328c9 commit 4e1481d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source/stdcpp/test/vector.d
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,17 @@ else version (CppRuntime_Clang)
assert(vec.size == 7);
}
}

void foo(ref vector!int vec)
{
//modify vector argument
vec.clear;
}

unittest
{
vector!int obj = 5;
assert(obj.size == 5);
foo(obj);
assert(obj.size == 0);
}

0 comments on commit 4e1481d

Please sign in to comment.