-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// Created by yonggyulee on 2024. 8. 4. | ||
// | ||
|
||
#ifndef PREVIEW_MEMORY_DESTROY_N_H_ | ||
#define PREVIEW_MEMORY_DESTROY_N_H_ | ||
|
||
#include "preview/__memory/addressof.h" | ||
#include "preview/__memory/destroy_at.h" | ||
|
||
namespace preview { | ||
|
||
template<typename NothrowForwardIterator, typename Size> | ||
constexpr NothrowForwardIterator destroy_n(NothrowForwardIterator first, Size n) { | ||
for (; n > 0; (void)++first, --n) | ||
preview::destroy_at(preview::addressof(*first)); | ||
return first; | ||
} | ||
|
||
} // namespace preview | ||
|
||
#endif // PREVIEW_MEMORY_DESTROY_N_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters