I'm writing a code that implements simple command line calculator, and I wanted to add a function for user to create his own variables with numeric values for better calculations. Can anyone share any advice, what technique should I use? I thought about creating an allocated two-dimensional string array and later just converting numeric values or use a template, something like that:
template<class T>
void UserVariables(T varname, T varvalue){
T tArray[2][MAX_VARS]={ {varname1, varvalue1}, {varname2, varvalue2}, ... };
....
}
Maybe there are any better and less noobie-ish decisions out there? Thanks in advance.
Your options are here:
std::unordered_map
std::map
std::unordered_multimap
std::multimap