Merge pull request #827 from YosysHQ/gatecat/idstring-in
idstring: Add 'in' function from Yosys
This commit is contained in:
commit
9d8d3bdbc4
@ -58,6 +58,16 @@ struct IdString
|
|||||||
bool empty() const { return index == 0; }
|
bool empty() const { return index == 0; }
|
||||||
|
|
||||||
unsigned int hash() const { return index; }
|
unsigned int hash() const { return index; }
|
||||||
|
|
||||||
|
template <typename... Args> bool in(Args... args) const
|
||||||
|
{
|
||||||
|
// Credit: https://articles.emptycrate.com/2016/05/14/folds_in_cpp11_ish.html
|
||||||
|
bool result = false;
|
||||||
|
(void)std::initializer_list<int>{(result = result || in(args), 0)...};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool in(const IdString &rhs) const { return *this == rhs; }
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
Loading…
Reference in New Issue
Block a user