5#include <casadi/core/casadi_types.hpp>
13template <
class Loader,
class F>
18 throw std::invalid_argument(
19 "Unable to load function '" +
loader.format_name(name) +
27 return T(
loader(name), std::forward<Args>(
args)...);
35 std::forward<Loader>(
loader), name, std::forward<Args>(
args)...));
36 }
catch (casadi::CasadiException &) {
38 }
catch (std::out_of_range &) {
44using dim = std::pair<casadi_int, casadi_int>;
45inline constexpr auto dims(
auto...
a) {
46 if constexpr ((... && std::is_constructible_v<
dim,
decltype(
a)>))
47 return std::array{
a...};
49 return std::array{
dim{
a, 1}...};
std::string demangled_typename(const std::type_info &t)
Get the pretty name of the given type as a string.
auto wrapped_load(Loader &&loader, const char *name, Args &&...args)
std::optional< T > try_load(Loader &&loader, const char *name, Args &&...args)
constexpr auto dims(auto... a)
std::pair< casadi_int, casadi_int > dim
auto wrap_load(Loader &&loader, const char *name, F f)