Nonogram solver
Revisión | c262007b49e7466915d867b3f4fa245da566092a (tree) |
---|---|
Tiempo | 2021-02-19 21:48:28 |
Autor | Alexander Larin <scalar438@gmai...> |
Commiter | Alexander Larin |
Fill can_place_suffix
@@ -34,6 +34,13 @@ | ||
34 | 34 | |
35 | 35 | void resize(size_t new_size) { m_data_ptr->resize(new_size); } |
36 | 36 | |
37 | + std::vector<T> move_out() | |
38 | + { | |
39 | + auto old_ptr = m_data_ptr; | |
40 | + m_data_ptr = &m_data; | |
41 | + return std::move(*old_ptr); | |
42 | + } | |
43 | + | |
37 | 44 | private: |
38 | 45 | std::vector<T> m_data; |
39 | 46 |
@@ -53,10 +53,10 @@ | ||
53 | 53 | calc_blocks_placeability(cells, blocks, can_place_prefix); |
54 | 54 | { |
55 | 55 | std::vector<ReversedVector<bool>> can_place_suffix_rev; |
56 | - for (auto &vec : can_place_suffix) | |
57 | - can_place_suffix_rev.push_back(ReversedVector(vec)); | |
58 | 56 | calc_blocks_placeability(ReversedVector(cells), ReversedVector(blocks), |
59 | 57 | can_place_suffix_rev); |
58 | + for (auto &rev_vector : can_place_suffix_rev) | |
59 | + can_place_suffix.emplace_back(rev_vector.move_out()); | |
60 | 60 | } |
61 | 61 | |
62 | 62 | calc_blocks_placeability(ReversedVector(cells), ReversedVector(blocks), can_place_suffix); |