Laptop Windows 2024-02-21 23:54:11 -05:00
parent 1f009bd093
commit 5ffb89af93
2 changed files with 31 additions and 7 deletions

@ -1 +1 @@
Subproject commit 43cf8c0ba1c151048679d0cfbeb6d82dab757a64 Subproject commit 89bde7c6e85ab50de988fb3f7b91d2041b41a4cb

View File

@ -140,15 +140,39 @@ namespace fb
}; };
template<typename ARG_TYPE> template<typename ENUM_TYPE>
struct operator_t class arg_constraint_container
{
private:
blt::vector<std::vector<ENUM_TYPE>> map;
public:
template<typename T, std::enable_if<std::is_convertible_v<T, blt::vector<std::vector<ENUM_TYPE>>>, bool> = true>
constexpr explicit arg_constraint_container(T&& map): map(std::forward<T>(map))
{}
template<typename T, std::enable_if<std::is_convertible_v<T, blt::vector<ENUM_TYPE>>, bool> = true>
constexpr explicit arg_constraint_container(blt::size_t argc, T&& map)
{
for (blt::size_t i = 0; i < argc; i++)
this->map.push_back(map);
}
constexpr arg_constraint_container(std::initializer_list<blt::vector<ENUM_TYPE>> maps)
{
for (const auto& v : maps)
this->map.push_back(v);
}
};
template<typename ARG_TYPE, typename ENUM_TYPE>
class operator_t
{ {
private: private:
arg_count_t argc; arg_count_t argc;
std::function<ARG_TYPE(blt::span<ARG_TYPE>)> func; std::function<ARG_TYPE(blt::span<ARG_TYPE>)> func;
blt::vector<operator_t<ARG_TYPE>> allowed_inputs; arg_constraint_container<ENUM_TYPE> allowed_inputs;
public: public:
operator_t(arg_count_t argc, std::function<ARG_TYPE(blt::span<ARG_TYPE>)> func): argc(argc), func(std::move(func)) constexpr operator_t(arg_count_t argc, std::function<ARG_TYPE(blt::span<ARG_TYPE>)> func): argc(argc), func(std::move(func))
{} {}
[[nodiscard]] constexpr arg_count_t argCount() const [[nodiscard]] constexpr arg_count_t argCount() const