fix an issue that node sockets can be duplicated
This commit is contained in:
@@ -7,14 +7,17 @@
|
||||
namespace nf7::util {
|
||||
|
||||
template <typename T>
|
||||
inline void Uniq(std::vector<T>& v) noexcept {
|
||||
inline size_t Uniq(std::vector<T>& v) noexcept {
|
||||
size_t n = 0;
|
||||
for (auto itr = v.begin(); itr < v.end();) {
|
||||
if (v.end() != std::find(itr+1, v.end(), *itr)) {
|
||||
itr = v.erase(itr);
|
||||
++n;
|
||||
} else {
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
} // namespace nf7::util
|
||||
|
Reference in New Issue
Block a user