eosio multi index secondary index
voting::identity_index identities(_self, _self.value); auto idx = identities.get_index<"byhash"_n>(); auto itr = idx.find(out); eosio_assert(itr == identities.end(), "User already registered to vote!");
Here is what the above code is Doing:
1. We’re creating a new table called identities.
2. We’re creating a secondary index called byhash.
3. We’re creating a new identity and storing it in the identities table.
4. We’re creating a new identity and storing it in the byhash index.
5. We’re checking to see if the identity already exists in the byhash index.