|
@@ -807,6 +807,7 @@ namespace robotics {
|
|
*/
|
|
*/
|
|
template<bool _Unlock = true>
|
|
template<bool _Unlock = true>
|
|
bool contains(_Type const& value) {
|
|
bool contains(_Type const& value) {
|
|
|
|
+ bool result = false;
|
|
typename std::vector<_Type>::const_iterator it;
|
|
typename std::vector<_Type>::const_iterator it;
|
|
for (size_t i = 0; i < source_ok_.size(); ++i) {
|
|
for (size_t i = 0; i < source_ok_.size(); ++i) {
|
|
if (!source_ok_[i]) {
|
|
if (!source_ok_[i]) {
|
|
@@ -814,7 +815,8 @@ namespace robotics {
|
|
}
|
|
}
|
|
it = source_.begin() + i;
|
|
it = source_.begin() + i;
|
|
if (*it == value) {
|
|
if (*it == value) {
|
|
- return true;
|
|
|
|
|
|
+ result = true;
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if constexpr (_Unlock) {
|
|
if constexpr (_Unlock) {
|
|
@@ -829,6 +831,7 @@ namespace robotics {
|
|
*/
|
|
*/
|
|
template<bool _Unlock = true>
|
|
template<bool _Unlock = true>
|
|
bool contains(std::function<bool(typename std::vector<_Type>::const_iterator)>const& fn) {
|
|
bool contains(std::function<bool(typename std::vector<_Type>::const_iterator)>const& fn) {
|
|
|
|
+ bool result = false;
|
|
typename std::vector<_Type>::const_iterator it;
|
|
typename std::vector<_Type>::const_iterator it;
|
|
for (size_t i = 0; i < source_ok_.size(); ++i) {
|
|
for (size_t i = 0; i < source_ok_.size(); ++i) {
|
|
if (!source_ok_[i]) {
|
|
if (!source_ok_[i]) {
|
|
@@ -836,7 +839,8 @@ namespace robotics {
|
|
}
|
|
}
|
|
it = source_.begin() + i;
|
|
it = source_.begin() + i;
|
|
if (fn(it)) {
|
|
if (fn(it)) {
|
|
- return true;
|
|
|
|
|
|
+ result = true;
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if constexpr (_Unlock) {
|
|
if constexpr (_Unlock) {
|
|
@@ -1001,15 +1005,17 @@ namespace robotics {
|
|
*/
|
|
*/
|
|
template<bool _Unlock = true>
|
|
template<bool _Unlock = true>
|
|
bool empty() {
|
|
bool empty() {
|
|
|
|
+ bool result = true;
|
|
for (bool it : source_ok_) {
|
|
for (bool it : source_ok_) {
|
|
if (it) {
|
|
if (it) {
|
|
- return false;
|
|
|
|
|
|
+ result = false;
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if constexpr (_Unlock) {
|
|
if constexpr (_Unlock) {
|
|
unlock();
|
|
unlock();
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* @brief 改变事件
|
|
* @brief 改变事件
|
|
@@ -1823,6 +1829,7 @@ namespace robotics {
|
|
*/
|
|
*/
|
|
template<bool _Unlock = true>
|
|
template<bool _Unlock = true>
|
|
bool contains(std::shared_ptr<_Type> const& value) {
|
|
bool contains(std::shared_ptr<_Type> const& value) {
|
|
|
|
+ bool result = false;
|
|
typename std::vector<std::shared_ptr<_Type>>::const_iterator it;
|
|
typename std::vector<std::shared_ptr<_Type>>::const_iterator it;
|
|
for (size_t i = 0; i < source_ok_.size(); ++i) {
|
|
for (size_t i = 0; i < source_ok_.size(); ++i) {
|
|
if (!source_ok_[i]) {
|
|
if (!source_ok_[i]) {
|
|
@@ -1830,13 +1837,14 @@ namespace robotics {
|
|
}
|
|
}
|
|
it = source_.begin() + i;
|
|
it = source_.begin() + i;
|
|
if (**it == *value) {
|
|
if (**it == *value) {
|
|
- return true;
|
|
|
|
|
|
+ result = true;
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if constexpr (_Unlock) {
|
|
if constexpr (_Unlock) {
|
|
unlock();
|
|
unlock();
|
|
}
|
|
}
|
|
- return false;
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* @brief 是否存在
|
|
* @brief 是否存在
|
|
@@ -1845,6 +1853,7 @@ namespace robotics {
|
|
*/
|
|
*/
|
|
template<bool _Unlock = true>
|
|
template<bool _Unlock = true>
|
|
bool contains(std::function<bool(std::shared_ptr<const _Type> const&)>const& fn) {
|
|
bool contains(std::function<bool(std::shared_ptr<const _Type> const&)>const& fn) {
|
|
|
|
+ bool result = false;
|
|
typename std::vector<std::shared_ptr<_Type>>::const_iterator it;
|
|
typename std::vector<std::shared_ptr<_Type>>::const_iterator it;
|
|
for (size_t i = 0; i < source_ok_.size(); ++i) {
|
|
for (size_t i = 0; i < source_ok_.size(); ++i) {
|
|
if (!source_ok_[i]) {
|
|
if (!source_ok_[i]) {
|
|
@@ -1852,13 +1861,14 @@ namespace robotics {
|
|
}
|
|
}
|
|
it = source_.begin() + i;
|
|
it = source_.begin() + i;
|
|
if (fn(*it)) {
|
|
if (fn(*it)) {
|
|
- return true;
|
|
|
|
|
|
+ result = true;
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if constexpr (_Unlock) {
|
|
if constexpr (_Unlock) {
|
|
unlock();
|
|
unlock();
|
|
}
|
|
}
|
|
- return false;
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* @brief 选择
|
|
* @brief 选择
|
|
@@ -2003,15 +2013,17 @@ namespace robotics {
|
|
*/
|
|
*/
|
|
template<bool _Unlock = true>
|
|
template<bool _Unlock = true>
|
|
bool empty() {
|
|
bool empty() {
|
|
|
|
+ bool result = true;
|
|
for (bool it : source_ok_) {
|
|
for (bool it : source_ok_) {
|
|
if (it) {
|
|
if (it) {
|
|
- return false;
|
|
|
|
|
|
+ result = false;
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if constexpr (_Unlock) {
|
|
if constexpr (_Unlock) {
|
|
unlock();
|
|
unlock();
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* @brief 获取值
|
|
* @brief 获取值
|