5#include <casadi/core/casadi_types.hpp>
15template <
class Loader,
class F>
20 throw std::invalid_argument(
21 "Unable to load function '" +
loader.format_name(name) +
29 return T(
loader(name), std::forward<Args>(
args)...);
37 std::forward<Loader>(
loader), name, std::forward<Args>(
args)...));
38 }
catch (casadi::CasadiException &) {
40 }
catch (std::out_of_range &) {
46using dim = std::pair<casadi_int, casadi_int>;
47inline constexpr auto dims(
auto...
a) {
48 if constexpr ((... && std::is_constructible_v<
dim,
decltype(
a)>))
49 return std::array{
a...};
51 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)