36 lines
567 B
C++
36 lines
567 B
C++
#ifndef THWEAVER_BITWISE_H
|
|
#define THWEAVER_BITWISE_H
|
|
|
|
#include <concepts>
|
|
|
|
template <typename T>
|
|
concept Bitwise =
|
|
requires(T a, T b) {
|
|
{
|
|
a & b
|
|
}
|
|
-> std::same_as<T>;
|
|
{
|
|
a | b
|
|
}
|
|
-> std::same_as<T>;
|
|
{
|
|
a ^ b
|
|
}
|
|
-> std::same_as<T>;
|
|
{
|
|
~a
|
|
}
|
|
-> std::same_as<T>;
|
|
{
|
|
a << 1
|
|
}
|
|
-> std::same_as<T>;
|
|
{
|
|
a >> 1
|
|
}
|
|
-> std::same_as<T>;
|
|
};
|
|
|
|
#endif
|