mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
AK: Add a Conditional<condition, TrueType, FalseType> template
This allows you to select a type based on a compile-time condition.
This commit is contained in:
parent
10e0d4a196
commit
b98d8ad5b0
1 changed files with 11 additions and 0 deletions
|
@ -320,8 +320,19 @@ struct IsSame<T, T> {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<bool condition, class TrueType, class FalseType>
|
||||||
|
struct Conditional {
|
||||||
|
typedef TrueType Type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class TrueType, class FalseType>
|
||||||
|
struct Conditional<false, TrueType, FalseType> {
|
||||||
|
typedef FalseType Type;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using AK::Conditional;
|
||||||
using AK::ceil_div;
|
using AK::ceil_div;
|
||||||
using AK::clamp;
|
using AK::clamp;
|
||||||
using AK::exchange;
|
using AK::exchange;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue