soci icon indicating copy to clipboard operation
soci copied to clipboard

std::vector<soci::row>::resize() The specified type does not meet the requirements of Cpp17MoveInsertable

Open kuvaldini opened this issue 4 years ago • 5 comments

      using namespace soci;
      constexpr int BATCH_SIZE = 30;
      std::vector<row> rows(BATCH_SIZE);
      statement st = (sql.prepare << "select * from table", into(rows));
      st.execute();
      while (st.fetch()) {
         std::vector<int>::iterator pos;
         for (pos = valsOut.begin(); pos != valsOut.end(); ++pos) {
            cout << *pos << '\n';
         }
         rows.resize(BATCH_SIZE); //ERROR
      }
In template: static_assert failed due to requirement '__is_cpp17_move_insertable<std::allocator<soci::row>, false>::value' "The specified type does not meet the requirements of Cpp17MoveInsertable"

kuvaldini avatar Jul 25 '21 20:07 kuvaldini

This is clearly related to your Peer class which must not be default constructible or something like this. When reporting a bug, please provide a simple self-contained example reproducing the problem, not just some snippet of code.

vadz avatar Jul 26 '21 12:07 vadz

Could you reread the error message once more?

In template: static_assert failed due to requirement '__is_cpp17_move_insertable<std::allocator<soci::row>, false>::value' "The specified type does not meet the requirements of Cpp17MoveInsertable"

It tells nothing related to my code. The problem is with soci::row!

kuvaldini avatar Jul 27 '21 13:07 kuvaldini

And as you could also see my class Peer existed only in a function parameters, (now removed) and does not participate.

kuvaldini avatar Jul 27 '21 13:07 kuvaldini

Sorry, I didn't notice/realize you used vector of rows. We need to make row movable to fix this.

vadz avatar Jul 27 '21 15:07 vadz

Yes. Thanks a lot for understanding and attention.

Sorry, I didn't notice/realize you used vector of rows. We need to make row movable to fix this.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/SOCI/soci/issues/900#issuecomment-887597886 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJH3F3SLLZV4663ETRH4ODTZ3EKTANCNFSM5A63UCQA .

kuvaldini avatar Jul 28 '21 05:07 kuvaldini