-
Notifications
You must be signed in to change notification settings - Fork 12
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
1 parent
42e952a
commit 7fa110f
Showing
7 changed files
with
241 additions
and
41 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
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,34 @@ | ||
// include/beman/execution26/detail/intrusive_queue.hpp -*-C++-*- | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_INTRUSIVE_QUEUE | ||
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_INTRUSIVE_QUEUE | ||
|
||
#include <utility> | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
namespace beman::execution26::detail { | ||
template <auto> | ||
struct intrusive_queue; | ||
|
||
template <typename T, T* T::* next> | ||
struct intrusive_queue<next> { | ||
T* head{}; | ||
T* tail{}; | ||
|
||
auto push(T* n) -> void { | ||
if (this->head) { | ||
std::exchange(this->tail, n)->*next = n; | ||
} else { | ||
this->head = this->tail = n; | ||
} | ||
} | ||
auto pop() -> T* { return std::exchange(this->head, this->head->*next); } | ||
auto empty() const -> bool { return this->head == nullptr; } | ||
}; | ||
} // namespace beman::execution26::detail | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
#endif |
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
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
Oops, something went wrong.