Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
NoumanAmir657 committed Sep 8, 2024
1 parent 64bfc39 commit 04178da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 1 addition & 2 deletions libcxx/include/__algorithm/fill.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& _
std::fill_n(__first, __last - __first, __value);
}

template <class _SegmentedIterator,
class _Tp>
template <class _SegmentedIterator, class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value) {
std::for_each(__first, __last, [__value](_Tp& __val) { __val = __value; });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <algorithm>
#include <cassert>
#include <deque>

#include "test_macros.h"
#include "test_iterators.h"
Expand Down Expand Up @@ -144,6 +145,18 @@ void test6()
std::fill_n(&foo[0], UDI(5), Storage());
}

void
test_deque()
{
std::deque<int> dq(5);
std::fill_n(dq.begin(), dq.size(), 4);
assert(dq[0] == 4);
assert(dq[1] == 4);
assert(dq[2] == 4);
assert(dq[3] == 4);
assert(dq[4] == 4);
}


int main(int, char**)
{
Expand Down Expand Up @@ -171,4 +184,4 @@ int main(int, char**)
#endif

return 0;
}
}

0 comments on commit 04178da

Please sign in to comment.