Skip to content

Commit 6f2c28f

Browse files
authored
♻️ Remove blit_swap (#457)
* 🔥 remove egfrd/util/swap.hpp It is basically the same as core/swap.hpp. * 🔥 remove blit_swap and use std::swap In pre-C++11, there is no rvalue reference or std::move. In that era, we need to avoid deep copy while swapping containers like std::vector. In C++11, there are many specializations of std::move and move- constructors and move-assignment-operators.
1 parent b66ea15 commit 6f2c28f

File tree

3 files changed

+2
-45
lines changed

3 files changed

+2
-45
lines changed

ecell4/core/DynamicPriorityQueue.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include <iostream>
2424
#endif
2525

26-
#include "swap.hpp"
27-
28-
2926
namespace ecell4
3027
{
3128

@@ -453,7 +450,8 @@ inline void DynamicPriorityQueue<Titem_, Tcomparator_, Tpolicy_>::pop_by_index(i
453450
policy_type::pop(index, item.first, items_.back().first);
454451

455452
// 2. pop the item from the items_.
456-
blit_swap(item, items_.back());
453+
using std::swap; // ADL-based specialization
454+
swap(item, items_.back());
457455
items_.pop_back();
458456

459457
const index_type removed_pos(position_vector_[index]);

ecell4/core/swap.hpp

Lines changed: 0 additions & 23 deletions
This file was deleted.

ecell4/egfrd/utils/swap.hpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)