Files
revng-revng/include/revng/MFP/SetLattices.h
Ivan Krysak bc98e0079f Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-02 13:20:49 +02:00

31 lines
832 B
C++

#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include <algorithm>
template<typename LE>
struct SetUnionLattice {
using LatticeElement = LE;
static LatticeElement combineValues(const LatticeElement &Left,
const LatticeElement &Right) {
LatticeElement Result;
std::set_union(Left.begin(),
Left.end(),
Right.begin(),
Right.end(),
std::inserter(Result, Result.begin()));
return Result;
}
static bool isLessOrEqual(const LatticeElement &Left,
const LatticeElement &Right) {
if (Left.size() > Right.size())
return false;
return std::includes(Right.begin(), Right.end(), Left.begin(), Left.end());
}
};