Class vec_index (o2scl)¶
-
class vec_index¶
A class to assign string labels to array indices.
- Idea for Future:
Create a method to remove strings from the list
Constructors
-
inline vec_index()¶
Create an empty assignment.
-
inline vec_index(const std::vector<std::string> &list)¶
Create an assignment based on the strings in
list
.
-
inline vec_index(std::initializer_list<std::string> list)¶
Create an assignment based on the strings in
list
.
Translation between size_t and string
-
inline std::string operator()(size_t i) const¶
Return the string of index
i
.
-
inline size_t operator()(std::string s) const¶
Return the index of string
s
.
-
inline std::string operator[](size_t i) const¶
Return the string of index
i
.
-
inline size_t operator[](std::string s) const¶
Return the index of string
s
.
Other useful methods
-
inline size_t size() const¶
Return the size.
-
inline std::vector<std::string> list() const¶
Return the list of strings.