phylanx
phylanx copied to clipboard
Postincrement/preincrement range iterator problem
@hkaiser If I write the code this way it doesn't work properly:
auto decoded_dense = phylanx::execution_tree::extract_numeric_value(*it++);
auto log_prob = phylanx::execution_tree::extract_numeric_value(*it);
HPX_TEST_EQ(
phylanx::ir::node_data<double>(std::move(expected_decoded_dense)), decoded_dense);
HPX_TEST(
allclose(phylanx::ir::node_data<double>(std::move(expected_log_prob)), log_prob));
but if I do this instead:
auto decoded_dense = phylanx::execution_tree::extract_numeric_value(*it);
auto log_prob = phylanx::execution_tree::extract_numeric_value(*++it);
HPX_TEST_EQ(
phylanx::ir::node_data<double>(std::move(expected_decoded_dense)), decoded_dense);
HPX_TEST(
allclose(phylanx::ir::node_data<double>(std::move(expected_log_prob)), log_prob));
it works properly.
Originally posted by @scheherzade in https://github.com/STEllAR-GROUP/phylanx/pull/938