Skip to content

Commit

Permalink
clear for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Nyarko authored and Emmanuel Nyarko committed Feb 21, 2024
1 parent 2939bda commit e338d6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/stdcpp/test/vector.d
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,8 @@ else version (CppRuntime_Clang)
assert(vec.size == 5);
vec.pop_back();
assert(vec.size == 4);
vec.clear(); // clear all content
assert(vec.empty() == 1);
assert(vec.size() == 0);
}
}
6 changes: 6 additions & 0 deletions source/stdcpp/vector.d
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,12 @@ extern(D):
assert(!empty(), "vector.pop_back called on an empty container");
this.__destruct_at_end(this.__end_ -1);
}
///
void clear()
{
__base_destruct_at_end(this.__begin_);
//Todo: add ASAN annotation for shrinkage
}

private:
pointer __begin_;
Expand Down

0 comments on commit e338d6f

Please sign in to comment.