|
|
@@ -7,6 +7,7 @@
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
+#include <array>
|
|
|
#include <tuple>
|
|
|
|
|
|
namespace matcher {
|
|
|
@@ -15,9 +16,26 @@ namespace matcher {
|
|
|
|
|
|
template <typename T>
|
|
|
bool operator==(T const &, any_t) { return true; }
|
|
|
- template <typename T>
|
|
|
- bool operator==(any_t, T const &) { return true; }
|
|
|
+}
|
|
|
+
|
|
|
+namespace matcher {
|
|
|
+ template <typename T, size_t I>
|
|
|
+ struct any_of_t {
|
|
|
+ std::array<T, I> options;
|
|
|
+ };
|
|
|
+
|
|
|
+ template <typename T, size_t I>
|
|
|
+ bool operator==(T const & t, any_of_t<T, I> const & of) {
|
|
|
+ return std::find(of.options.begin(), of.options.end(), t) != of.options.end();
|
|
|
+ }
|
|
|
|
|
|
+ template <typename... Args>
|
|
|
+ any_of_t<typename std::common_type<Args...>::type, sizeof...(Args)> any_of(Args &&... args) {
|
|
|
+ return {{args...}};
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+namespace matcher {
|
|
|
template <typename... Args>
|
|
|
struct matcher {
|
|
|
public:
|