More type safety on SelectFlags
This commit is contained in:
parent
533079c389
commit
95cc08a19e
13
src/main.cc
13
src/main.cc
|
@ -335,18 +335,23 @@ private:
|
|||
template<typename T>
|
||||
Repeated<T> repeated(T func) { return Repeated<T>(func); }
|
||||
|
||||
namespace SelectFlags
|
||||
{
|
||||
enum Type
|
||||
enum class SelectFlags
|
||||
{
|
||||
None = 0,
|
||||
Reverse = 1,
|
||||
Inclusive = 2,
|
||||
Extend = 4
|
||||
};
|
||||
constexpr SelectFlags operator|(SelectFlags lhs, SelectFlags rhs)
|
||||
{
|
||||
return (SelectFlags)((int) lhs | (int) rhs);
|
||||
}
|
||||
constexpr bool operator&(SelectFlags lhs, SelectFlags rhs)
|
||||
{
|
||||
return ((int) lhs & (int) rhs) != 0;
|
||||
}
|
||||
|
||||
template<int flags>
|
||||
template<SelectFlags flags>
|
||||
void select_to_next_char(Context& context)
|
||||
{
|
||||
int param = context.numeric_param();
|
||||
|
|
Loading…
Reference in New Issue
Block a user