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