intrusive_list: Make Remove and IsEmpty stdlib compatible

Makes the name match the standard library equivalents.

C++17 introduces non-member empty() which allows for nicer handling
in generic contexts. May as well make the data structure compatible with
it.
This commit is contained in:
Lioncash 2016-08-18 21:23:51 -04:00 committed by MerryMage
parent 23d190f7b0
commit a8ba15f0d5
3 changed files with 4 additions and 4 deletions

View file

@ -91,7 +91,7 @@ public:
* Removes node from list * Removes node from list
* @param node Node to remove from list. * @param node Node to remove from list.
*/ */
void Remove(reference node) { void remove(reference node) {
node.UnlinkFromList(); node.UnlinkFromList();
} }
@ -99,7 +99,7 @@ public:
* Is this list empty? * Is this list empty?
* @returns true if there are no nodes in this list. * @returns true if there are no nodes in this list.
*/ */
bool IsEmpty() { bool empty() const {
return root->next == root.get(); return root->next == root.get();
} }

View file

@ -66,7 +66,7 @@ bool ArmTranslatorVisitor::ConditionPassed(Cond cond) {
// non-AL cond // non-AL cond
if (!ir.block.instructions.IsEmpty()) { if (!ir.block.instructions.empty()) {
// We've already emitted instructions. Quit for now, we'll make a new block here later. // We've already emitted instructions. Quit for now, we'll make a new block here later.
cond_state = ConditionalState::Break; cond_state = ConditionalState::Break;
ir.SetTerm(IR::Term::LinkBlockFast{ir.current_location}); ir.SetTerm(IR::Term::LinkBlockFast{ir.current_location});

View file

@ -61,7 +61,7 @@ void DeadCodeElimination(IR::Block& block) {
// We iterate over the instructions in reverse order. // We iterate over the instructions in reverse order.
// This is because removing an instruction reduces the number of uses for earlier instructions. // This is because removing an instruction reduces the number of uses for earlier instructions.
if (block.instructions.IsEmpty()) { if (block.instructions.empty()) {
return; return;
} }