Every single example out there that shows how to use a secondary index in the EOSIO platform, including the scant documentation on the function found here: https://eosio.github.io/eosio.cdt/latest/group__multiindex/#function-get_index, declares its value locally using the keyword auto, like this:

void myaction() {
    auto zip_index = addresses.get_index<name("zip")>();

As I don't need to initialise this value in every method where I use it, I'd like to declare it in my contract class and initialise it in the constructor. However, I cannot declare it in the class using auto:

/Users/ekkis/dev/eos/dapp.cpp:39:5: error: 'auto' not allowed in non-static class member auto idxtst;

can anyone tell me how to properly declare the correct type?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.