Public Member Functions | Protected Attributes | List of all members
o2scl::vec_index Class Reference

A class to assign string labels to array indices. More...

#include <misc.h>

Public Member Functions

 vec_index ()
 Create an empty assignment.
 
 vec_index (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.
 
std::string operator() (size_t i)
 Return the string of index i.
 
size_t operator() (std::string s)
 Return the index of string s.
 
std::string operator[] (size_t i)
 Return the string of index i.
 
size_t operator[] (std::string s)
 Return the index of string s.
 
void append (std::string s)
 Add string s and assign it the next index.
 
void append (std::initializer_list< std::string > list)
 Add a list of strings.
 

Protected Attributes

std::map< std::string, size_t, std::greater< std::string > > tmap
 The map version for string lookup.
 
std::vector< std::string > tvec
 The vector version for size_t lookup.
 

Detailed Description

Definition at line 505 of file misc.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).