if I declare a string and attempt to print it like this:
std::string s;
eosio::print(s);
the EOS compiler pukes:
In file included from t.cpp:1: In file included from ./t.hpp:4: In file included from /usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/../include/eosiolib/asset.hpp:3: /usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/../include/eosiolib/print.hpp:237:9: error: no member named 'print' in 'std::__1::basic_string' t.print(); ~ ^ t.cpp:126:3: note: in instantiation of function template specialization 'eosio::print &>' requested here print(ret); ^ 1 error generated.
but if I convert it:
eosio::print(std::string(s));
it works fine. why is this necessary? s
is already a string so why do I need this?