3#include <casadi/core/casadi_types.hpp>
4#include <casadi/core/external.hpp>
17 }
catch (
const std::invalid_argument &e) {
18 throw std::invalid_argument(
"Unable to load function '" +
so_name +
19 ":" + name +
"': " + e.what());
23template <
class T,
class...
Args>
27 return T(casadi::external(name,
so_name), std::forward<Args>(
args)...);
31template <
class T,
class...
Args>
35 return std::make_optional(
37 }
catch (casadi::CasadiException &e) {
42using dim = std::pair<casadi_int, casadi_int>;
43inline constexpr auto dims(
auto...
a) {
44 if constexpr ((... && std::is_constructible_v<
dim,
decltype(
a)>))
45 return std::array{
a...};
47 return std::array{
dim{
a, 1}...};
constexpr auto dims(auto... a)
std::optional< T > try_load(const std::string &so_name, const char *name, Args &&...args)
std::pair< casadi_int, casadi_int > dim
auto wrap_load(const std::string &so_name, const char *name, F f)
auto wrapped_load(const std::string &so_name, const char *name, Args &&...args)