Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 88a4ebf4 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

Use move in the swap function of the quicksorts

parent 9b7d7536
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
#include <cstdlib>
#include <cstring>
#include <vector> // For parallel without task
#include <utility> // For move
#include "FGlobal.hpp"
#include "FMemUtils.hpp"
......@@ -43,9 +44,9 @@ protected:
/** swap to value */
template <class NumType>
static inline void Swap(NumType& value, NumType& other){
NumType temp = value;
value = other;
other = temp;
const NumType temp = std::move(value);
value = std::move(other);
other = std::move(temp);
}
////////////////////////////////////////////////////////////
......
......@@ -21,6 +21,7 @@
#include "FLog.hpp"
#include <memory>
#include <utility>
template <class SortType, class CompareType, class IndexType>
class FQuickSortMpi : public FQuickSort< SortType, CompareType, IndexType> {
......@@ -38,9 +39,9 @@ class FQuickSortMpi : public FQuickSort< SortType, CompareType, IndexType> {
static void Swap(SortType& value, SortType& other){
SortType temp = value;
value = other;
other = temp;
const SortType temp = std::move(value);
value = std::move(other);
other = std::move(temp);
}
/* A local iteration of qs */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment