main
Brett 2024-03-01 01:41:48 -05:00
parent 50ebf1051e
commit d97c08ca16
2 changed files with 35 additions and 35 deletions

View File

@ -9,7 +9,7 @@ if(!MSVC)
add_compile_options(-march=native) add_compile_options(-march=native)
endif() endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON) #set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
add_subdirectory(libs/BLT) add_subdirectory(libs/BLT)

View File

@ -210,40 +210,40 @@ namespace fb
}; };
template<typename ENUM_TYPE, typename ARG_TYPE, typename Func, operator_t<ENUM_TYPE, ARG_TYPE, Func>... operators> // template<typename ENUM_TYPE, typename ARG_TYPE, typename Func, operator_t<ENUM_TYPE, ARG_TYPE, Func>... operators>
inline constexpr auto max_args() // inline constexpr auto max_args()
{ // {
return std::max({operators.argCount()...}); // return std::max({operators.argCount()...});
} // }
//
template<typename ENUM_TYPE, typename ARG_TYPE, typename Func, operator_t<ENUM_TYPE, ARG_TYPE, Func>... operators> // template<typename ENUM_TYPE, typename ARG_TYPE, typename Func, operator_t<ENUM_TYPE, ARG_TYPE, Func>... operators>
inline constexpr auto enum_max() // inline constexpr auto enum_max()
{ // {
return std::max({static_cast<blt::i32>(operators.type())...}); // return std::max({static_cast<blt::i32>(operators.type())...});
} // }
//
template<typename ENUM_TYPE, typename ARG_TYPE, typename Func, operator_t<ENUM_TYPE, ARG_TYPE, Func>... operators> // template<typename ENUM_TYPE, typename ARG_TYPE, typename Func, operator_t<ENUM_TYPE, ARG_TYPE, Func>... operators>
struct gp_program_container_t // struct gp_program_container_t
{ // {
constexpr static inline auto MAX_OPERATORS = enum_max<operators...>(); // constexpr static inline auto MAX_OPERATORS = enum_max<operators...>();
constexpr static inline auto MAX_ARGS = max_args<operators...>(); // constexpr static inline auto MAX_ARGS = max_args<operators...>();
std::array<std::array<blt::vector<ENUM_TYPE>, MAX_ARGS>, MAX_OPERATORS> argument_constraints; // std::array<std::array<blt::vector<ENUM_TYPE>, MAX_ARGS>, MAX_OPERATORS> argument_constraints;
std::array<arg_count_t, MAX_OPERATORS> argument_count; // std::array<arg_count_t, MAX_OPERATORS> argument_count;
std::array<Func, MAX_OPERATORS> functions; // std::array<Func, MAX_OPERATORS> functions;
}; // };
//
template<typename ENUM_TYPE, typename ARG_TYPE, typename Func, operator_t<ENUM_TYPE, ARG_TYPE, Func>... operators> // template<typename ENUM_TYPE, typename ARG_TYPE, typename Func, operator_t<ENUM_TYPE, ARG_TYPE, Func>... operators>
inline auto make_gp_program() // inline auto make_gp_program()
{ // {
gp_program_container_t<ARG_TYPE, ENUM_TYPE, Func, operators...> program; // gp_program_container_t<ARG_TYPE, ENUM_TYPE, Func, operators...> program;
for (const operator_t<ENUM_TYPE, ARG_TYPE, Func>& op : {operators...}) // for (const operator_t<ENUM_TYPE, ARG_TYPE, Func>& op : {operators...})
{ // {
auto index = static_cast<blt::i32>(op.type()); // auto index = static_cast<blt::i32>(op.type());
for (const auto& v : blt::enumerate(op.argMap())) // for (const auto& v : blt::enumerate(op.argMap()))
program.argument_constraints[index][v.first] = v.second; // program.argument_constraints[index][v.first] = v.second;
} // }
return program; // return program;
} // }
/* /*
* Functions * Functions