@@ -79,16 +79,16 @@ class Atom {
7979};
8080
8181namespace __private__ ::atoms {
82- inline Atom ok (" ok" );
83- inline Atom error (" error" );
84- inline Atom nil (" nil" );
85- inline Atom true_ (" true" );
86- inline Atom false_ (" false" );
87- inline Atom __struct__ (" __struct__" );
88- inline Atom __exception__ (" __exception__" );
89- inline Atom message (" message" );
90- inline Atom ElixirArgumentError (" Elixir.ArgumentError" );
91- inline Atom ElixirRuntimeError (" Elixir.RuntimeError" );
82+ inline auto ok = Atom (" ok" );
83+ inline auto error = Atom (" error" );
84+ inline auto nil = Atom (" nil" );
85+ inline auto true_ = Atom (" true" );
86+ inline auto false_ = Atom (" false" );
87+ inline auto __struct__ = Atom (" __struct__" );
88+ inline auto __exception__ = Atom (" __exception__" );
89+ inline auto message = Atom (" message" );
90+ inline auto ElixirArgumentError = Atom (" Elixir.ArgumentError" );
91+ inline auto ElixirRuntimeError = Atom (" Elixir.RuntimeError" );
9292} // namespace __private__::atoms
9393
9494// Result tagged tuples
@@ -350,7 +350,7 @@ struct Decoder<T, std::void_t<decltype(T::module), decltype(T::fields)>> {
350350private:
351351 template <typename U>
352352 static void set_field (ErlNifEnv *env, ERL_NIF_TERM term, T &ex_struct,
353- Atom *atom, U T::*field_ptr) {
353+ U T::*field_ptr, const Atom *atom ) {
354354 ERL_NIF_TERM value;
355355 if (!enif_get_map_value (env, term, encode (env, *atom), &value)) {
356356 throw std::invalid_argument (
@@ -546,9 +546,9 @@ struct Encoder<T, std::void_t<decltype(T::module), decltype(T::fields)>> {
546546
547547 std::apply (
548548 [&](auto ... field) {
549- ((keys[Indices] = fine::encode (env, *std::get<0 >(field)),
549+ ((keys[Indices] = fine::encode (env, *std::get<1 >(field)),
550550 values[Indices] =
551- fine::encode (env, ex_struct.*(std::get<1 >(field)))),
551+ fine::encode (env, ex_struct.*(std::get<0 >(field)))),
552552 ...);
553553 },
554554 fields);
@@ -865,7 +865,7 @@ inline int load(ErlNifEnv *env, void **priv_data, ERL_NIF_TERM load_info) {
865865 auto load = fine::__private__::load; \
866866 static ErlNifEntry entry = {ERL_NIF_MAJOR_VERSION, \
867867 ERL_NIF_MINOR_VERSION, \
868- # name, \
868+ name, \
869869 num_funcs, \
870870 funcs, \
871871 load, \
0 commit comments