qicosmos/iguana

unexpected exception

qicosmos opened this issue · 2 comments

this code will throw exception:

struct Contents_t {
  std::unique_ptr<std::vector<std::unique_ptr<int>>> vec;
  std::string b;
};
REFLECTION(Contents_t, vec, b);

void test_sp() {
  auto vec = std::make_unique<std::vector<std::unique_ptr<int>>>();
  vec->push_back(std::make_unique<int>(42));
  vec->push_back(std::make_unique<int>(21));
  Contents_t contents{std::move(vec), "test"};
  std::string str;
  iguana::to_xml(contents, str);

  Contents_t cont;
  iguana::from_xml(cont, str); //throw exception.
  std::cout << cont.b << "\n";
}

detail:

exception of type std::runtime_error: Failed to parse number

has been solved.