move std function
This commit is contained in:
@@ -247,7 +247,7 @@ PIHTTPClient * PIHTTPClient::onFinish(std::function<void()> f) {
|
||||
|
||||
|
||||
PIHTTPClient * PIHTTPClient::onFinish(std::function<void(const PIHTTP::MessageConst &)> f) {
|
||||
on_finish = f;
|
||||
on_finish = std::move(f);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ PIHTTPClient * PIHTTPClient::onError(std::function<void()> f) {
|
||||
|
||||
|
||||
PIHTTPClient * PIHTTPClient::onError(std::function<void(const PIHTTP::MessageConst &)> f) {
|
||||
on_error = f;
|
||||
on_error = std::move(f);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ PIHTTPClient * PIHTTPClient::onAbort(std::function<void()> f) {
|
||||
|
||||
|
||||
PIHTTPClient * PIHTTPClient::onAbort(std::function<void(const PIHTTP::MessageConst &)> f) {
|
||||
on_abort = f;
|
||||
on_abort = std::move(f);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ bool PIHTTPServer::registerPath(const PIString & path, PIHTTP::Method method, Re
|
||||
Endpoint ep;
|
||||
if (!ep.create(path)) return false;
|
||||
ep.method = method;
|
||||
ep.function = functor;
|
||||
ep.function = std::move(functor);
|
||||
endpoints[ep.priority] << ep;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
|
||||
//! \~english Sets the factory used to create accepted client objects.
|
||||
//! \~russian Устанавливает фабрику, создающую объекты принятых клиентов.
|
||||
void setClientFactory(std::function<ServerClient *()> f) { client_factory = f; }
|
||||
void setClientFactory(std::function<ServerClient *()> f) { client_factory = std::move(f); }
|
||||
|
||||
private:
|
||||
void newClient(ServerClient * c);
|
||||
|
||||
@@ -204,7 +204,7 @@ public:
|
||||
|
||||
//! \~english Sets the callback receiving both key event and user data.
|
||||
//! \~russian Устанавливает обратный вызов, получающий событие клавиши и пользовательские данные.
|
||||
void setSlot(KBFunc slot) { ret_func = slot; }
|
||||
void setSlot(KBFunc slot) { ret_func = std::move(slot); }
|
||||
|
||||
//! \~english Sets the callback that only receives the key event and ignores user data.
|
||||
//! \~russian Устанавливает обратный вызов, получающий только событие клавиши и игнорирующий пользовательские данные.
|
||||
|
||||
@@ -184,7 +184,7 @@ public:
|
||||
//! \endcode
|
||||
inline PIDeque(size_t piv_size, std::function<T(size_t i)> f) {
|
||||
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
|
||||
expand(piv_size, f);
|
||||
expand(piv_size, std::move(f));
|
||||
}
|
||||
|
||||
//! \~english Move constructor.
|
||||
@@ -729,7 +729,7 @@ public:
|
||||
//! заданному в передаваемой функции `test`, или `def` если такого элемента нет.
|
||||
//! \~\sa \a indexWhere()
|
||||
inline const T & atWhere(std::function<bool(const T & e)> test, ssize_t start = 0, const T & def = T()) const {
|
||||
const ssize_t i = indexWhere(test, start);
|
||||
const ssize_t i = indexWhere(std::move(test), start);
|
||||
if (i < 0)
|
||||
return def;
|
||||
else
|
||||
@@ -743,7 +743,7 @@ public:
|
||||
//! заданному в передаваемой функции `test`, или `def` если такого элемента нет.
|
||||
//! \~\sa \a lastIndexWhere()
|
||||
inline const T & lastAtWhere(std::function<bool(const T & e)> test, ssize_t start = -1, const T & def = T()) const {
|
||||
const ssize_t i = lastIndexWhere(test, start);
|
||||
const ssize_t i = lastIndexWhere(std::move(test), start);
|
||||
if (i < 0)
|
||||
return def;
|
||||
else
|
||||
@@ -1265,7 +1265,7 @@ public:
|
||||
deleteT(pid_data + pid_start + new_size, pid_size - new_size);
|
||||
pid_size = new_size;
|
||||
} else if (new_size > pid_size) {
|
||||
expand(new_size, f);
|
||||
expand(new_size, std::move(f));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -1328,15 +1328,15 @@ public:
|
||||
if (index < pid_size - 1) {
|
||||
const size_t os = pid_size - index - 1;
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start + index + 1),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
os * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
os * sizeof(T));
|
||||
}
|
||||
} else {
|
||||
alloc_backward(pid_size + 1, -1);
|
||||
if (index > 0) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + 1),
|
||||
index * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + 1),
|
||||
index * sizeof(T));
|
||||
}
|
||||
}
|
||||
elementNew(pid_data + pid_start + index, e);
|
||||
@@ -1358,15 +1358,15 @@ public:
|
||||
if (index < pid_size - 1) {
|
||||
const size_t os = pid_size - index - 1;
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start + index + 1),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
os * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
os * sizeof(T));
|
||||
}
|
||||
} else {
|
||||
alloc_backward(pid_size + 1, -1);
|
||||
if (index > 0) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + 1),
|
||||
index * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + 1),
|
||||
index * sizeof(T));
|
||||
}
|
||||
}
|
||||
elementNew(pid_data + pid_start + index, std::move(e));
|
||||
@@ -1393,15 +1393,15 @@ public:
|
||||
alloc_forward(pid_size + v.pid_size);
|
||||
if (os > 0) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start + index + v.pid_size),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
os * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
os * sizeof(T));
|
||||
}
|
||||
} else {
|
||||
alloc_backward(pid_size + v.pid_size, -v.pid_size);
|
||||
if (index > 0) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + v.pid_size),
|
||||
index * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + v.pid_size),
|
||||
index * sizeof(T));
|
||||
}
|
||||
}
|
||||
newT(pid_data + pid_start + index, v.pid_data + v.pid_start, v.pid_size);
|
||||
@@ -1426,15 +1426,15 @@ public:
|
||||
alloc_forward(pid_size + init_list.size());
|
||||
if (os > 0) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start + index + init_list.size()),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
os * sizeof(T));
|
||||
}
|
||||
} else {
|
||||
alloc_backward(pid_size + init_list.size(), -init_list.size());
|
||||
if (index > 0) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + init_list.size()),
|
||||
index * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + init_list.size()),
|
||||
index * sizeof(T));
|
||||
}
|
||||
}
|
||||
newT(pid_data + pid_start + index, init_list.begin(), init_list.size());
|
||||
@@ -1462,13 +1462,13 @@ public:
|
||||
deleteT(pid_data + pid_start + index, count);
|
||||
if (os <= index) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start + index),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index + count),
|
||||
os * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index + count),
|
||||
os * sizeof(T));
|
||||
} else {
|
||||
if (index > 0) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start + count),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
index * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
index * sizeof(T));
|
||||
}
|
||||
pid_start += count;
|
||||
}
|
||||
@@ -1540,7 +1540,7 @@ public:
|
||||
//! \endcode
|
||||
//! \~\sa \a sort()
|
||||
inline PIDeque<T> & sort(std::function<bool(const T & a, const T & b)> comp) {
|
||||
std::stable_sort(begin(), end(), comp);
|
||||
std::stable_sort(begin(), end(), std::move(comp));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1654,7 +1654,13 @@ public:
|
||||
//! \endcode
|
||||
//! \~\sa \a remove(), \a removeOne(), \a removeWhere()
|
||||
inline PIDeque<T> & removeWhere(std::function<bool(const T & e)> test) {
|
||||
ssize_t j = indexWhere(test);
|
||||
ssize_t j = -1;
|
||||
for (size_t i = pid_start; i < pid_start + pid_size; ++i) {
|
||||
if (test(pid_data[i])) {
|
||||
j = ssize_t(i) - pid_start;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j != -1) {
|
||||
for (size_t i = j + 1; i < pid_size; ++i) {
|
||||
if (!test(pid_data[i + pid_start])) {
|
||||
@@ -2545,21 +2551,21 @@ public:
|
||||
if (index + count > pid_size) count = pid_size - index;
|
||||
ret.alloc_forward(count);
|
||||
memcpy(reinterpret_cast<void *>(ret.pid_data + ret.pid_start),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
count * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index),
|
||||
count * sizeof(T));
|
||||
|
||||
const size_t os = pid_size - index - count;
|
||||
if (os <= index) {
|
||||
if (os > 0) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start + index),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index + count),
|
||||
os * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start + index + count),
|
||||
os * sizeof(T));
|
||||
}
|
||||
} else {
|
||||
if (index > 0) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + pid_start + count),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
index * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
index * sizeof(T));
|
||||
}
|
||||
pid_start += count;
|
||||
}
|
||||
@@ -2646,8 +2652,8 @@ private:
|
||||
size_t ns = (pid_rsize - pid_size) / 2;
|
||||
if (pid_start != ns) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + ns),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
pid_size * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
pid_size * sizeof(T));
|
||||
pid_start = ns;
|
||||
}
|
||||
}
|
||||
@@ -2656,8 +2662,8 @@ private:
|
||||
const size_t ns = (pid_rsize - pid_size) / 2;
|
||||
if (pid_start != ns) {
|
||||
memmove(reinterpret_cast<void *>(pid_data + ns),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
pid_size * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
pid_size * sizeof(T));
|
||||
pid_start = ns;
|
||||
}
|
||||
}
|
||||
@@ -2694,8 +2700,8 @@ private:
|
||||
PIINTROSPECTION_CONTAINER_ALLOC(T, (as - pid_rsize))
|
||||
if (pid_rsize > 0 && pid_data) {
|
||||
memcpy(reinterpret_cast<void *>(tmp_data + new_start),
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
pid_size * sizeof(T));
|
||||
reinterpret_cast<const void *>(pid_data + pid_start),
|
||||
pid_size * sizeof(T));
|
||||
dealloc();
|
||||
}
|
||||
pid_data = tmp_data;
|
||||
|
||||
@@ -184,7 +184,7 @@ public:
|
||||
//! \endcode
|
||||
inline PIVector(size_t size, std::function<T(size_t i)> f) {
|
||||
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
|
||||
expand(size, f);
|
||||
expand(size, std::move(f));
|
||||
}
|
||||
|
||||
//! \~english Move constructor.
|
||||
@@ -725,7 +725,7 @@ public:
|
||||
//! заданному в передаваемой функции `test`, или `def` если такого элемента нет.
|
||||
//! \~\sa \a indexWhere()
|
||||
inline const T & atWhere(std::function<bool(const T & e)> test, ssize_t start = 0, const T & def = T()) const {
|
||||
const ssize_t i = indexWhere(test, start);
|
||||
const ssize_t i = indexWhere(std::move(test), start);
|
||||
if (i < 0)
|
||||
return def;
|
||||
else
|
||||
@@ -739,7 +739,7 @@ public:
|
||||
//! заданному в передаваемой функции `test`, или `def` если такого элемента нет.
|
||||
//! \~\sa \a lastIndexWhere()
|
||||
inline const T & lastAtWhere(std::function<bool(const T & e)> test, ssize_t start = -1, const T & def = T()) const {
|
||||
const ssize_t i = lastIndexWhere(test, start);
|
||||
const ssize_t i = lastIndexWhere(std::move(test), start);
|
||||
if (i < 0)
|
||||
return def;
|
||||
else
|
||||
@@ -1267,7 +1267,7 @@ public:
|
||||
deleteT(piv_data + new_size, piv_size - new_size);
|
||||
piv_size = new_size;
|
||||
} else if (new_size > piv_size) {
|
||||
expand(new_size, f);
|
||||
expand(new_size, std::move(f));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -1486,7 +1486,7 @@ public:
|
||||
//! \endcode
|
||||
//! \~\sa \a sort()
|
||||
inline PIVector<T> & sort(std::function<bool(const T & a, const T & b)> comp) {
|
||||
std::stable_sort(begin(), end(), comp);
|
||||
std::stable_sort(begin(), end(), std::move(comp));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1599,7 +1599,13 @@ public:
|
||||
//! \endcode
|
||||
//! \~\sa \a remove(), \a removeOne(), \a removeWhere()
|
||||
inline PIVector<T> & removeWhere(std::function<bool(const T & e)> test) {
|
||||
ssize_t j = indexWhere(test);
|
||||
ssize_t j = -1;
|
||||
for (size_t i = 0; i < piv_size; ++i) {
|
||||
if (test(piv_data[i])) {
|
||||
j = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j != -1) {
|
||||
for (size_t i = j + 1; i < piv_size; ++i) {
|
||||
if (!test(piv_data[i])) {
|
||||
|
||||
@@ -1070,7 +1070,7 @@ public:
|
||||
//! \~english Counts elements in the flat vector that pass the `test`.
|
||||
//! \~russian Подсчитывает элементы в плоском векторе, проходящие `test`.
|
||||
//! \~\sa PIVector::entries(std::function)
|
||||
inline int entries(std::function<bool(const T & e)> test) const { return mat.entries(test); }
|
||||
inline int entries(std::function<bool(const T & e)> test) const { return mat.entries(std::move(test)); }
|
||||
|
||||
|
||||
//! \~english Returns the first index (row, col) of `e` in the 2D array.
|
||||
@@ -1086,7 +1086,7 @@ public:
|
||||
//! \~russian Возвращает первый индекс (строка, столбец) в двумерном массиве, проходящий `test`.
|
||||
//! \~\sa PIVector::indexWhere()
|
||||
inline Index indexWhere(std::function<bool(const T & e)> test, ssize_t start = 0) const {
|
||||
ssize_t flat = mat.indexWhere(test, start);
|
||||
ssize_t flat = mat.indexWhere(std::move(test), start);
|
||||
if (flat < 0 || cols_ == 0) return Index{-1, -1};
|
||||
return Index{flat / static_cast<ssize_t>(cols_), flat % static_cast<ssize_t>(cols_)};
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@ public:
|
||||
//! \~russian Возвращает последний индекс (строка, столбец) в двумерном массиве, проходящий `test`.
|
||||
//! \~\sa PIVector::lastIndexWhere()
|
||||
inline Index lastIndexWhere(std::function<bool(const T & e)> test, ssize_t start = -1) const {
|
||||
ssize_t flat = mat.lastIndexWhere(test, start);
|
||||
ssize_t flat = mat.lastIndexWhere(std::move(test), start);
|
||||
if (flat < 0 || cols_ == 0) return Index{-1, -1};
|
||||
return Index{flat / static_cast<ssize_t>(cols_), flat % static_cast<ssize_t>(cols_)};
|
||||
}
|
||||
@@ -1113,12 +1113,12 @@ public:
|
||||
//! \~english Tests if any element in the flat vector passes the `test`.
|
||||
//! \~russian Проверяет, проходит ли какой-либо элемент в плоском векторе `test`.
|
||||
//! \~\sa PIVector::any()
|
||||
inline bool any(std::function<bool(const T & e)> test) const { return mat.any(test); }
|
||||
inline bool any(std::function<bool(const T & e)> test) const { return mat.any(std::move(test)); }
|
||||
|
||||
//! \~english Tests if all elements in the flat vector pass the `test`.
|
||||
//! \~russian Проверяет, проходят ли все элементы в плоском векторе `test`.
|
||||
//! \~\sa PIVector::every()
|
||||
inline bool every(std::function<bool(const T & e)> test) const { return mat.every(test); }
|
||||
inline bool every(std::function<bool(const T & e)> test) const { return mat.every(std::move(test)); }
|
||||
|
||||
//! \~english Fills the entire 2D array with copies of `e`.
|
||||
//! \~russian Заполняет весь двумерный массив копиями `e`.
|
||||
@@ -1132,7 +1132,7 @@ public:
|
||||
//! \~russian Заполняет весь двумерный массив, используя функцию-генератор `f` на основе плоского индекса.
|
||||
//! \~\sa PIVector::fill(std::function)
|
||||
inline PIVector2D<T> & fill(std::function<T(size_t i)> f) {
|
||||
mat.fill(f);
|
||||
mat.fill(std::move(f));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1228,7 +1228,7 @@ public:
|
||||
//! \~\sa PIVector::map()
|
||||
template<typename ST>
|
||||
inline PIVector2D<ST> map(std::function<ST(const T & e)> f) const {
|
||||
return PIVector2D<ST>(rows_, cols_, mat.template map<ST>(f));
|
||||
return PIVector2D<ST>(rows_, cols_, mat.template map<ST>(std::move(f)));
|
||||
}
|
||||
|
||||
//! \~english Applies a function (with row and col indices) to each element and returns a new 2D array.
|
||||
@@ -1250,23 +1250,26 @@ public:
|
||||
//! \~russian Применяет функцию к каждой строке (с возможностью изменения).
|
||||
//! \~\sa forEachRow() const, PIVector::forEach()
|
||||
inline PIVector2D<T> & forEachRow(std::function<void(Row)> f) {
|
||||
for (size_t r = 0; r < rows_; ++r)
|
||||
for (size_t r = 0; r < rows_; ++r) {
|
||||
f(row(r));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Applies a function to each row (read-only).
|
||||
//! \~russian Применяет функцию к каждой строке (только чтение).
|
||||
inline void forEachRow(std::function<void(RowConst)> f) const {
|
||||
for (size_t r = 0; r < rows_; ++r)
|
||||
for (size_t r = 0; r < rows_; ++r) {
|
||||
f(row(r));
|
||||
}
|
||||
}
|
||||
|
||||
//! \~english Applies a function to each column (modifiable).
|
||||
//! \~russian Применяет функцию к каждому столбцу (с возможностью изменения).
|
||||
inline PIVector2D<T> & forEachColumn(std::function<void(Col)> f) {
|
||||
for (size_t c = 0; c < cols_; ++c)
|
||||
for (size_t c = 0; c < cols_; ++c) {
|
||||
f(col(c));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1274,8 +1277,9 @@ public:
|
||||
//! \~russian Применяет функцию к каждому столбцу (только чтение).
|
||||
//! \param f Function taking a \a ColConst.
|
||||
inline void forEachColumn(std::function<void(ColConst)> f) const {
|
||||
for (size_t c = 0; c < cols_; ++c)
|
||||
for (size_t c = 0; c < cols_; ++c) {
|
||||
f(col(c));
|
||||
}
|
||||
}
|
||||
|
||||
//! \~english Accumulates a value across all elements.
|
||||
@@ -1283,7 +1287,7 @@ public:
|
||||
//! \~\sa PIVector::reduce()
|
||||
template<typename ST>
|
||||
inline ST reduce(std::function<ST(const T & e, const ST & acc)> f, const ST & initial = ST()) const {
|
||||
return mat.template reduce<ST>(f, initial);
|
||||
return mat.template reduce<ST>(std::move(f), initial);
|
||||
}
|
||||
|
||||
//! \~english Accumulates a value across all elements with indices.
|
||||
|
||||
@@ -731,7 +731,7 @@ public:
|
||||
//! \~\brief
|
||||
//! \~english Constructor that takes a function to execute
|
||||
//! \~russian Конструктор, который принимает функцию для выполнения
|
||||
explicit PIScopeExitCall(std::function<void()> f): func(f) {}
|
||||
explicit PIScopeExitCall(std::function<void()> f): func(std::move(f)) {}
|
||||
|
||||
//! \~\brief
|
||||
//! \~english Destructor that executes the function if it exists
|
||||
|
||||
@@ -113,11 +113,11 @@ public:
|
||||
|
||||
//! \~english Sets the callback that receives parsed requests and returns replies.
|
||||
//! \~russian Устанавливает callback, который получает разобранные запросы и возвращает ответы.
|
||||
void setRequestCallback(std::function<PIHTTP::MessageMutable(const PIHTTP::MessageConst &)> c) { callback = c; }
|
||||
void setRequestCallback(std::function<PIHTTP::MessageMutable(const PIHTTP::MessageConst &)> c) { callback = std::move(c); }
|
||||
|
||||
//! \~english Sets the credential validator used when HTTP Basic authentication is enabled.
|
||||
//! \~russian Устанавливает валидатор учетных данных, используемый при включенной HTTP Basic-аутентификации.
|
||||
void setBasicAuthCallback(std::function<bool(const PIString &, const PIString &)> c) { callback_auth = c; }
|
||||
void setBasicAuthCallback(std::function<bool(const PIString &, const PIString &)> c) { callback_auth = std::move(c); }
|
||||
|
||||
private:
|
||||
static void addFixedHeaders(PIHTTP::MessageMutable & msg);
|
||||
|
||||
@@ -419,7 +419,7 @@ public:
|
||||
//! \~\param f
|
||||
//! \~english The callback function returning the next file path, or nullptr to use the internal generator.
|
||||
//! \~russian Функция обратного вызова, возвращающая путь к следующему файлу, или nullptr для использования внутреннего генератора.
|
||||
void setFuncGetNewFilePath(std::function<PIString()> f) { f_new_path = f; }
|
||||
void setFuncGetNewFilePath(std::function<PIString()> f) { f_new_path = std::move(f); }
|
||||
|
||||
//! \~english Writes one record with explicit ID and payload.
|
||||
//! \~russian Записывает одну запись с явным идентификатором и данными.
|
||||
|
||||
@@ -177,7 +177,7 @@ void PIIODevice::setReopenTimeout(PISystemTime timeout) {
|
||||
//! после каждого успешного потокового чтения. Метод должен быть
|
||||
//! в формате "bool func(void * data, uchar * readed, int size)"
|
||||
void PIIODevice::setThreadedReadSlot(ReadRetFunc func) {
|
||||
func_read = func;
|
||||
func_read = std::move(func);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -103,15 +103,15 @@ public:
|
||||
|
||||
//! \~english Sets custom header validation callback.
|
||||
//! \~russian Устанавливает пользовательский callback проверки заголовка.
|
||||
void setHeaderCheckSlot(PacketExtractorHeaderFunc f) { func_header = f; }
|
||||
void setHeaderCheckSlot(PacketExtractorHeaderFunc f) { func_header = std::move(f); }
|
||||
|
||||
//! \~english Sets custom payload validation callback.
|
||||
//! \~russian Устанавливает пользовательский callback проверки полезной нагрузки.
|
||||
void setPayloadCheckSlot(PacketExtractorPayloadFunc f) { func_payload = f; }
|
||||
void setPayloadCheckSlot(PacketExtractorPayloadFunc f) { func_payload = std::move(f); }
|
||||
|
||||
//! \~english Sets custom footer validation callback.
|
||||
//! \~russian Устанавливает пользовательский callback проверки окончания пакета.
|
||||
void setFooterCheckSlot(PacketExtractorFooterFunc f) { func_footer = f; }
|
||||
void setFooterCheckSlot(PacketExtractorFooterFunc f) { func_footer = std::move(f); }
|
||||
|
||||
|
||||
//! \~english Switches packet extraction to mode "mode".
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
//! \~russian Связывает ключ "key" с callback-функцией "func" без аргументов полезной нагрузки.
|
||||
void assign(Key key, std::function<void()> func) {
|
||||
auto lf = [func](PIByteArray) { func(); };
|
||||
functions[key] << lf;
|
||||
functions[key] << std::move(lf);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
func(v);
|
||||
}
|
||||
};
|
||||
functions[key] << lf;
|
||||
functions[key] << std::move(lf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ struct PIP_EXPORT Function {
|
||||
identifier = name;
|
||||
arguments = args;
|
||||
type = bfCustom;
|
||||
handler = h;
|
||||
handler = std::move(h);
|
||||
}
|
||||
|
||||
PIString identifier;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//! \~russian Математический вектор
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Math vector
|
||||
Math vector
|
||||
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -805,11 +805,12 @@ public:
|
||||
|
||||
//! \~english Applies \a f to every coordinate without modifying the vector.
|
||||
//! \~russian Применяет \a f к каждой координате без изменения вектора.
|
||||
void forEach(std::function<void(const Type &)> f) const { c.forEach(f); }
|
||||
void forEach(std::function<void(const Type &)> f) const { c.forEach(std::move(f)); }
|
||||
|
||||
//! \~english Applies \a f to every coordinate and returns this vector.
|
||||
//! \~russian Применяет \a f к каждой координате и возвращает этот вектор.
|
||||
_CVector & forEach(std::function<void(Type &)> f) {
|
||||
c.forEach(f);
|
||||
c.forEach(std::move(f));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
//! \~english Sets a callback invoked when the machine finishes.
|
||||
//! \~russian Задает callback-функцию, вызываемую при завершении машины.
|
||||
void setOnFinish(std::function<void()> f) { on_finish = f; }
|
||||
void setOnFinish(std::function<void()> f) { on_finish = std::move(f); }
|
||||
|
||||
|
||||
//! \~english Posts an event to active states and triggers the first matching transition.
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
template<typename Ret, typename... Args>
|
||||
FunctionBase * makeFunction(std::function<Ret(Args...)> func) {
|
||||
auto * ret = new Function<Args...>();
|
||||
ret->func = func;
|
||||
ret->func = std::move(func);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
//! \~russian Объявляет состояния, используемые в PIStateMachine
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
State machine node
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
State machine node
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -196,10 +196,10 @@ class PIP_EXPORT PIStateLambda: public PIStateBase {
|
||||
public:
|
||||
//! \~english Creates a state backed by enter and exit callbacks.
|
||||
//! \~russian Создает состояние с callback-функциями входа и выхода.
|
||||
PIStateLambda(std::function<void()> on_enter, std::function<void()> on_exit = nullptr, const PIString & n = {}): PIStateBase(n) {
|
||||
enter = on_enter;
|
||||
exit = on_exit;
|
||||
}
|
||||
PIStateLambda(std::function<void()> on_enter, std::function<void()> on_exit = nullptr, const PIString & n = {})
|
||||
: PIStateBase(n)
|
||||
, enter(std::move(on_enter))
|
||||
, exit(std::move(on_exit)) {}
|
||||
|
||||
|
||||
//! \~english Executes the enter callback.
|
||||
@@ -228,9 +228,8 @@ class PIP_EXPORT PIStateFinal: public PIStateBase {
|
||||
public:
|
||||
//! \~english Creates a final state with an optional callback executed on entry.
|
||||
//! \~russian Создает финальное состояние с необязательной callback-функцией, выполняемой при входе.
|
||||
PIStateFinal(std::function<void()> on_finish = nullptr, const PIString & n = {}): PIStateBase(n) {
|
||||
PIStateFinal(std::function<void()> on_finish = nullptr, const PIString & n = {}): PIStateBase(n), enter(std::move(on_finish)) {
|
||||
is_final = true;
|
||||
enter = on_finish;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ PITransitionBase::~PITransitionBase() {
|
||||
|
||||
|
||||
PITransitionBase * PITransitionBase::addAction(std::function<void()> a) {
|
||||
action = a;
|
||||
action = std::move(a);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
//! \~english Installs callback that receives grabbed signals.
|
||||
//! \~russian Устанавливает обратный вызов, получающий перехваченные сигналы.
|
||||
static void setSlot(SignalEvent slot) { ret_func = slot; }
|
||||
static void setSlot(SignalEvent slot) { ret_func = std::move(slot); }
|
||||
|
||||
//! \~english Redirects selected signals to the slot set by \a setSlot().
|
||||
//! \~russian Перенаправляет выбранные сигналы в обработчик, заданный через \a setSlot().
|
||||
|
||||
@@ -86,11 +86,9 @@ void PIConditionVariable::wait(PIMutex & lk) {
|
||||
}
|
||||
|
||||
|
||||
void PIConditionVariable::wait(PIMutex & lk, const std::function<bool()> & condition) {
|
||||
bool isCondition;
|
||||
void PIConditionVariable::wait(PIMutex & lk, std::function<bool()> condition) {
|
||||
while (true) {
|
||||
isCondition = condition();
|
||||
if (isCondition) break;
|
||||
if (condition()) break;
|
||||
#if defined(WINDOWS)
|
||||
SleepConditionVariableCS(&PRIVATE->nativeHandle, (PCRITICAL_SECTION)lk.handle(), INFINITE);
|
||||
#elif defined(FREERTOS)
|
||||
@@ -122,8 +120,7 @@ bool PIConditionVariable::waitFor(PIMutex & lk, PISystemTime timeout) {
|
||||
}
|
||||
|
||||
|
||||
bool PIConditionVariable::waitFor(PIMutex & lk, PISystemTime timeout, const std::function<bool()> & condition) {
|
||||
bool isCondition;
|
||||
bool PIConditionVariable::waitFor(PIMutex & lk, PISystemTime timeout, std::function<bool()> condition) {
|
||||
#if defined(WINDOWS) || defined(FREERTOS)
|
||||
PITimeMeasurer measurer;
|
||||
#else
|
||||
@@ -135,8 +132,7 @@ bool PIConditionVariable::waitFor(PIMutex & lk, PISystemTime timeout, const std:
|
||||
xEventGroupClearBits(PRIVATE->nativeHandle, 1);
|
||||
#endif
|
||||
while (true) {
|
||||
isCondition = condition();
|
||||
if (isCondition) break;
|
||||
if (condition()) break;
|
||||
bool isTimeout;
|
||||
#if defined(WINDOWS)
|
||||
isTimeout = SleepConditionVariableCS(&PRIVATE->nativeHandle,
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
//! \param condition вызываемый объект или функция, не принимающая аргументов и возвращающая значение, которое может быть оценено как
|
||||
//! bool. Вызывается повторно, пока не примет значение true
|
||||
//!
|
||||
virtual void wait(PIMutex & lk, const std::function<bool()> & condition);
|
||||
virtual void wait(PIMutex & lk, std::function<bool ()> condition);
|
||||
|
||||
|
||||
//! \~english Waits for at most \a timeout and returns \c true if awakened before it expires.
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
//! bool. Вызывается повторно, пока не примет значение true
|
||||
//! \return false если достигнут таймаут, или true если условие пробуждения истинно
|
||||
//!
|
||||
virtual bool waitFor(PIMutex & lk, PISystemTime timeout, const std::function<bool()> & condition);
|
||||
virtual bool waitFor(PIMutex & lk, PISystemTime timeout, std::function<bool()> condition);
|
||||
|
||||
private:
|
||||
PRIVATE_DECLARATION(PIP_EXPORT)
|
||||
|
||||
@@ -540,7 +540,7 @@ PRIVATE_DEFINITION_END(PIThread)
|
||||
PIThread::PIThread(void * data, ThreadFunc func, bool startNow, PISystemTime loop_delay): PIObject() {
|
||||
PIINTROSPECTION_THREAD_NEW(this);
|
||||
data_ = data;
|
||||
ret_func = func;
|
||||
ret_func = std::move(func);
|
||||
terminating = running_ = lockRun = false;
|
||||
priority_ = piNormal;
|
||||
delay_ = loop_delay;
|
||||
@@ -609,13 +609,13 @@ bool PIThread::start(PISystemTime loop_delay) {
|
||||
|
||||
|
||||
bool PIThread::start(ThreadFunc func) {
|
||||
ret_func = func;
|
||||
ret_func = std::move(func);
|
||||
return start();
|
||||
}
|
||||
|
||||
|
||||
bool PIThread::start(ThreadFunc func, PISystemTime loop_delay) {
|
||||
ret_func = func;
|
||||
ret_func = std::move(func);
|
||||
delay_ = loop_delay;
|
||||
return start();
|
||||
}
|
||||
@@ -641,7 +641,7 @@ bool PIThread::startOnce() {
|
||||
|
||||
|
||||
bool PIThread::startOnce(ThreadFunc func) {
|
||||
ret_func = func;
|
||||
ret_func = std::move(func);
|
||||
return startOnce();
|
||||
}
|
||||
|
||||
@@ -738,12 +738,12 @@ bool PIThread::_startThread(void * func) {
|
||||
#ifdef FREERTOS
|
||||
|
||||
auto name_ba = createThreadName();
|
||||
if (xTaskCreate((__THREAD_FUNC_RET__ (*)(void *))func,
|
||||
(const char *)name_ba.data(), // A name just for humans
|
||||
128, // This stack size can be checked & adjusted by reading the Stack Highwater
|
||||
this,
|
||||
priority_,
|
||||
&PRIVATE->thread) == pdPASS) {
|
||||
if (xTaskCreate((__THREAD_FUNC_RET__(*)(void *))func,
|
||||
(const char *)name_ba.data(), // A name just for humans
|
||||
128, // This stack size can be checked & adjusted by reading the Stack Highwater
|
||||
this,
|
||||
priority_,
|
||||
&PRIVATE->thread) == pdPASS) {
|
||||
tid_ = (llong)PRIVATE->thread;
|
||||
return true;
|
||||
}
|
||||
@@ -752,7 +752,7 @@ bool PIThread::_startThread(void * func) {
|
||||
|
||||
if (PRIVATE->thread) CloseHandle(PRIVATE->thread);
|
||||
# ifdef CC_GCC
|
||||
PRIVATE->thread = (void *)_beginthreadex(0, 0, (__THREAD_FUNC_RET__ (*)(void *))func, this, CREATE_SUSPENDED, 0);
|
||||
PRIVATE->thread = (void *)_beginthreadex(0, 0, (__THREAD_FUNC_RET__(*)(void *))func, this, CREATE_SUSPENDED, 0);
|
||||
# else
|
||||
PRIVATE->thread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)func, this, CREATE_SUSPENDED, 0);
|
||||
# endif
|
||||
@@ -766,7 +766,7 @@ bool PIThread::_startThread(void * func) {
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
int ret = pthread_create(&PRIVATE->thread, &attr, (__THREAD_FUNC_RET__ (*)(void *))func, this);
|
||||
int ret = pthread_create(&PRIVATE->thread, &attr, (__THREAD_FUNC_RET__(*)(void *))func, this);
|
||||
pthread_attr_destroy(&attr);
|
||||
// PICout(PICoutManipulators::DefaultControls) << "pthread_create" << PRIVATE->thread;
|
||||
// piCout << "started" << PRIVATE->thread;
|
||||
@@ -884,8 +884,8 @@ void PIThread::_runThread() {
|
||||
PIINTROSPECTION_THREAD_RUN(this);
|
||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "...";
|
||||
if (lockRun) thread_mutex.lock();
|
||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "ok";
|
||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "run" << "...";
|
||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "ok";
|
||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "run" << "...";
|
||||
#ifdef PIP_INTROSPECTION
|
||||
PITimeMeasurer _tm;
|
||||
#endif
|
||||
@@ -1042,7 +1042,7 @@ void PIThread::runOnce(PIObject * object, const char * handler, const PIString &
|
||||
void PIThread::runOnce(std::function<void()> func, const PIString & name) {
|
||||
PIThread * t = new PIThread();
|
||||
t->setName(name);
|
||||
t->setSlot(func);
|
||||
t->setSlot(std::move(func));
|
||||
#ifndef MICRO_PIP
|
||||
__PIThreadCollection::instance()->startedAuto(t);
|
||||
CONNECT0(void, t, stopped, __PIThreadCollection::instance(), stoppedAuto);
|
||||
|
||||
@@ -68,8 +68,8 @@ PIThreadPoolExecutor::~PIThreadPoolExecutor() {
|
||||
}
|
||||
|
||||
|
||||
void PIThreadPoolExecutor::execute(const std::function<void()> & runnable) {
|
||||
if (!isShutdown_) taskQueue.offer(runnable);
|
||||
void PIThreadPoolExecutor::execute(std::function<void()> runnable) {
|
||||
if (!isShutdown_) taskQueue.offer(std::move(runnable));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
//! \~russian
|
||||
//! Это вызов по принципу best-effort без ожидания результата и без сообщения о том, была ли задача принята.
|
||||
//! \После запроса на завершение новые задачи игнорируются.
|
||||
void execute(const std::function<void()> & runnable);
|
||||
void execute(std::function<void()> runnable);
|
||||
|
||||
//! \~english Requests immediate shutdown and stops worker threads without waiting for queued tasks to finish.
|
||||
//! \~russian Запрашивает немедленное завершение и останавливает рабочие потоки без ожидания завершения задач в очереди.
|
||||
|
||||
@@ -136,7 +136,7 @@ PIThreadPoolLoop::~PIThreadPoolLoop() {
|
||||
|
||||
|
||||
void PIThreadPoolLoop::setFunction(std::function<void(int)> f) {
|
||||
func = f;
|
||||
func = std::move(f);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +163,6 @@ void PIThreadPoolLoop::exec(int index_start, int index_count) {
|
||||
|
||||
|
||||
void PIThreadPoolLoop::exec(int index_start, int index_count, std::function<void(int)> f) {
|
||||
setFunction(f);
|
||||
setFunction(std::move(f));
|
||||
exec(index_start, index_count);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
//! Метод возвращает **false** при любом условии для пустого массива.
|
||||
//! \~\details
|
||||
//! \~\sa \a every(), \a contains(), \a entries(), \a forEach()
|
||||
inline bool any(std::function<bool(uchar e)> test) const { return d.any(test); }
|
||||
inline bool any(std::function<bool(uchar e)> test) const { return d.any(std::move(test)); }
|
||||
|
||||
//! \~english Tests whether all elements in the array passes the test
|
||||
//! implemented by the provided function `test`.
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
//! Метод возвращает **true** при любом условии для пустого массива.
|
||||
//! \~\details
|
||||
//! \~\sa \a any(), \a contains(), \a entries(), \a forEach()
|
||||
inline bool every(std::function<bool(uchar e)> test) const { return d.every(test); }
|
||||
inline bool every(std::function<bool(uchar e)> test) const { return d.every(std::move(test)); }
|
||||
|
||||
//! \~english Full access to element by `index`.
|
||||
//! \~russian Полный доступ к элементу по индексу `index`.
|
||||
@@ -340,7 +340,7 @@ public:
|
||||
//! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу.
|
||||
//! Значение по умолчанию равно 0, что означает, что просматривается весь массив.
|
||||
//! \~\sa \a every(), \a any(), \a contains(), \a indexWhere()
|
||||
inline int entries(std::function<bool(uchar e)> test, ssize_t start = 0) const { return d.entries(test, start); }
|
||||
inline int entries(std::function<bool(uchar e)> test, ssize_t start = 0) const { return d.entries(std::move(test), start); }
|
||||
|
||||
bool startsWith(const PIByteArray & o) const;
|
||||
|
||||
@@ -405,7 +405,9 @@ public:
|
||||
//! piCout << v.indexWhere([](const uchar & s){return s > 10;}); // -1
|
||||
//! \endcode
|
||||
//! \~\sa \a indexOf(), \a lastIndexOf(), \a lastIndexWhere(), \a contains()
|
||||
inline ssize_t indexWhere(std::function<bool(const uchar & e)> test, ssize_t start = 0) const { return d.indexWhere(test, start); }
|
||||
inline ssize_t indexWhere(std::function<bool(const uchar & e)> test, ssize_t start = 0) const {
|
||||
return d.indexWhere(std::move(test), start);
|
||||
}
|
||||
|
||||
//! \~english Returns the last index at which a given element `e`
|
||||
//! can be found in the array, or `-1` if it is not present.
|
||||
@@ -469,7 +471,7 @@ public:
|
||||
//! и означает, что просматривается весь массив.
|
||||
//! \~\sa \a indexOf(), \a lastIndexOf(), \a indexWhere(), \a contains()
|
||||
inline ssize_t lastIndexWhere(std::function<bool(const uchar & e)> test, ssize_t start = -1) const {
|
||||
return d.lastIndexWhere(test, start);
|
||||
return d.lastIndexWhere(std::move(test), start);
|
||||
}
|
||||
|
||||
//! \~english Pointer to array
|
||||
@@ -525,7 +527,7 @@ public:
|
||||
//! \~\details
|
||||
//! \~\sa \a resize()
|
||||
inline PIByteArray & fill(std::function<uchar(size_t i)> f) {
|
||||
d.fill(f);
|
||||
d.fill(std::move(f));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -570,7 +572,7 @@ public:
|
||||
//! лишние элементы удаляются с конца массива.
|
||||
//! \~\sa \a size(), \a clear()
|
||||
inline PIByteArray & resize(size_t new_size, std::function<uchar(size_t i)> f) {
|
||||
d.resize(new_size, f);
|
||||
d.resize(new_size, std::move(f));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -738,7 +740,7 @@ public:
|
||||
//! \~\details
|
||||
//! \~\sa \a remove(), \a removeOne(), \a removeWhere()
|
||||
inline PIByteArray & removeWhere(std::function<bool(uchar e)> test) {
|
||||
d.removeWhere(test);
|
||||
d.removeWhere(std::move(test));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -950,7 +952,7 @@ public:
|
||||
//! piCout << v2; // {3, 5, 7}
|
||||
//! \endcode
|
||||
//! \~\sa \a map(), \a any(), \a every()
|
||||
inline PIByteArray filter(std::function<bool(const uchar & e)> test) const { return PIByteArray(d.filter(test)); }
|
||||
inline PIByteArray filter(std::function<bool(const uchar & e)> test) const { return PIByteArray(d.filter(std::move(test))); }
|
||||
|
||||
//! \~english Execute function `void f(const uchar & e)` for every element in array.
|
||||
//! \~russian Выполняет функцию `void f(const uchar & e)` для каждого элемента массива.
|
||||
@@ -966,7 +968,7 @@ public:
|
||||
//! piCout << s; // 15
|
||||
//! \endcode
|
||||
//! \~\sa \a filter(), \a map(), \a reduce(), \a any(), \a every()
|
||||
inline void forEach(std::function<void(const uchar & e)> f) const { d.forEach(f); }
|
||||
inline void forEach(std::function<void(const uchar & e)> f) const { d.forEach(std::move(f)); }
|
||||
|
||||
//! \~english Execute function `void f(uchar & e)` for every element in array.
|
||||
//! \~russian Выполняет функцию `void f(uchar & e)` для каждого элемента массива.
|
||||
@@ -982,7 +984,7 @@ public:
|
||||
//! \endcode
|
||||
//! \~\sa \a filter(), \a map(), \a reduce(), \a any(), \a every()
|
||||
inline PIByteArray & forEach(std::function<void(uchar & e)> f) {
|
||||
d.forEach(f);
|
||||
d.forEach(std::move(f));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1005,7 +1007,7 @@ public:
|
||||
//! \~\sa \a forEach(), \a reduce()
|
||||
template<typename ST>
|
||||
inline PIDeque<ST> map(std::function<ST(const uchar & e)> f) const {
|
||||
return d.map<ST>(f);
|
||||
return d.map<ST>(std::move(f));
|
||||
}
|
||||
|
||||
//! \~english Applies the function `ST f(const uchar & e, const ST & acc)`
|
||||
@@ -1051,7 +1053,7 @@ public:
|
||||
//! \~\sa \a forEach(), \a map()
|
||||
template<typename ST>
|
||||
inline ST reduce(std::function<ST(const uchar & e, const ST & acc)> f, const ST & initial = ST()) const {
|
||||
return d.reduce<ST>(f, initial);
|
||||
return d.reduce<ST>(std::move(f), initial);
|
||||
}
|
||||
|
||||
//! \~english Convert data to Base 64 and return this byte array
|
||||
|
||||
@@ -262,7 +262,7 @@ PIValueTree & PIValueTree::remove(const PIString & name) {
|
||||
|
||||
|
||||
void PIValueTree::forEachRecursive(std::function<void(const PIValueTree &, const PIString &)> func) {
|
||||
forEachRecursiveInternal(func);
|
||||
forEachRecursiveInternal(std::move(func));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user