Ticket #5423 (closed: fixed)
small helper function to check if a string belongs to vector of strings
Reported by: | Alex Buts | Owned by: | Alex Buts |
---|---|---|---|
Priority: | trivial | Milestone: | Release 2.2 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Jose Borreguero |
Description
Change History
comment:2 Changed 8 years ago by Alex Buts
can be written more generic and nicer, but does what I need to do.
comment:4 Changed 8 years ago by Alex Buts
- Status changed from accepted to verify
- Resolution set to fixed
comment:5 Changed 8 years ago by Alex Buts
refs #5423 this is it
Changeset: af851e67257a68a0c0576acef540261a7009b360
comment:6 Changed 8 years ago by Russell Taylor
This shouldn't be necessary...... just use std::find in the <algorithm> system header.
comment:7 Changed 8 years ago by Alex Buts
find is more generic but returns an iterator, and I use numbers, returned by this method, to cast strings to enums.
This may be unnecessary if the methodology, used in subscribing algorithms to factory is deployed but this request more work and I am a bit uncertain deploying C preprocessor. At the moment this simple and specific helper looks like the best solution for the problem I am dealing with.
comment:8 Changed 8 years ago by Russell Taylor
You can do arithmetic operations on iterators. For example, if find returns an iterator, it, to the 3rd element in a vector, vec (i.e. vec[2]) then it - vec.begin() will = 2
comment:9 Changed 8 years ago by Alex Buts
refs #5423 this is it
Changeset: af851e67257a68a0c0576acef540261a7009b360
comment:10 Changed 8 years ago by Jose Borreguero
- Status changed from verify to verifying
- Tester set to Jose Borreguero
comment:12 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 6269
refs #5423 this is it