I have two types:

struct typeA {
    std::vector<std::string> vec;

struct typeB {
    std::vector<std::string> vec;

but I can't seem to get the 2 vecs to mix as eosiocpp seems to be treating them as std::vector of unsigned char or something whenever I try to iterate or perform insert() on them. Literally:

typeA objA;
typeB objB;

for (auto s : objB.vec) {
    objA.vec.push_back(s); //<-- throws errors


objB.vec.insert(objB.vec.end(), objA.vec.begin(), objA.vec.end()); //<-- throws errors

the errors being

candidate function not viable: no known conversion from 'unsigned char' to
  'const value_type' (aka 'const std::__1::basic_string<char>') for 1st argument


 note: candidate function not viable: no known conversion from 'const_iterator'
  (aka '__wrap_iter<const unsigned char *>') to 'size_type' (aka 'unsigned int') for 2nd argument
iterator insert(const_iterator __position, size_type __n, const_reference __x);
 note: candidate template ignored: disabled by 'enable_if' [with _InputIterator =
  std::__1::__wrap_iter<const unsigned char *>]
         __is_input_iterator  <_InputIterator>::value &&

(which seems to be it's own set of problems as well).

Kind of pulling my hair out here.

  • _____________Bump? Oct 29, 2018 at 10:55
  • Have you tried declaring s with a specific type instead of auto? It might be that the type system is unable to determine the specific type of the vector. Nov 13, 2018 at 21:55


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.