File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,11 @@ std::vector<std::shared_ptr<Input>> Block::inputs() const
126126/* ! Adds an input and returns its index. */
127127int Block::addInput (std::shared_ptr<Input> input)
128128{
129+ auto it = std::find (impl->inputs .begin (), impl->inputs .end (), input);
130+
131+ if (it != impl->inputs .end ())
132+ return it - impl->inputs .begin ();
133+
129134 impl->inputs .push_back (input);
130135 return impl->inputs .size () - 1 ;
131136}
@@ -173,6 +178,11 @@ std::vector<std::shared_ptr<Field>> Block::fields() const
173178/* ! Adds a field and returns its index. */
174179int Block::addField (std::shared_ptr<Field> field)
175180{
181+ auto it = std::find (impl->fields .begin (), impl->fields .end (), field);
182+
183+ if (it != impl->fields .end ())
184+ return it - impl->fields .begin ();
185+
176186 impl->fields .push_back (field);
177187 return impl->fields .size () - 1 ;
178188}
You can’t perform that action at this time.
0 commit comments