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