Question about invoking a method in typemapper.hpp
eniv opened this issue · 1 comments
Hi,
I am enjoying your library, so first of all, thank you.
I am running into an issue invoking a function which accepts a struct that includes only two simple enums classes:
enum class A {
a1 = 0,
a2
};
enum class B {
b1 = 0,
b2
};
struct some_struct {
A a;
B b;
}
I can see the correct conversion happening in my custom typemapper: void from_json(const nlohmann::json& j, some_struct str)
, however, when the handler then invokes the function which was bound (happens in typemapper.hpp in: method(params[index].get<typename std::decay<ParamTypes>::type>()...);
) , the argument struct appears uninitialized, as if a copy didn't execute.
Can you suggest what is going wrong?
Disregard.
I didn't pay attention and provided a value type argument instead of a reference type argument for some_struct
in the typemapper.
void from_json(const nlohmann::json& j, some_struct str)
should be void from_json(const nlohmann::json& j, some_struct& str)