File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -450,17 +450,25 @@ bool contains_if(T const& _t, Predicate const& _p)
450450 return std::end (_t) != std::find_if (std::begin (_t), std::end (_t), _p);
451451}
452452
453+ // / Function that insert @param _elem into a vector @param _destination only if _elem is not
454+ // / already present in _destination vector.
455+ template <class T >
456+ void emplaceBackUnique (std::vector<T>& _destination, T _elem)
457+ {
458+ if (!contains (_destination, _elem))
459+ _destination.emplace_back (std::move (_elem));
460+ }
461+
453462// / Function that takes vector @param _destination and appends vector @param _source,
454463// / whilst only taking into account unique elements of _source.
455464template <class T >
456465void concatenateVectorWithoutDuplicates (std::vector<T>& _destination, std::vector<T> const & _source)
457466{
458467 for (auto && elem: _source)
459- if (!contains (_destination, elem))
460- _destination.emplace_back (std::move (elem));
468+ emplaceBackUnique (_destination, elem);
461469}
462470
463- // / Function that removes all elements present in vector @param _sub from vector @_super.
471+ // / Function that removes all elements present in vector @param _sub from vector @param _super.
464472template <class T >
465473void removeVectorSubset (std::vector<T>& _super, std::vector<T> const & _sub)
466474{
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ class IntroduceControlFlowSSA: public ASTModifier
166166 std::set<YulString> const & m_variablesToReplace;
167167 // / Variables (that are to be replaced) currently in scope.
168168 std::vector<YulString> m_variablesInScope;
169- // / Set of variables that do not have a specific value.
169+ // / Variables that do not have a specific value.
170170 std::vector<YulString> m_variablesToReassign;
171171 TypeInfo const & m_typeInfo;
172172};
You can’t perform that action at this time.
0 commit comments