You can use boost::sort, like this:
#include <vector>
#include <boost/range/algorithm.hpp>
std::vector<std::string> stringarray;
boost::sort(stringarray);
If you want use find use boost::find, like this:
std::string findme;
auto offset = boost::find(stringarray, findme) - stringarray.begin()
See 2 useful functions (m_stringarray should be member of ClassA):
const size_t ClassA::GetIdByName(std::string name) const
{
return (boost::find(this->m_stringarray, name) - this->m_stringarray.begin());
}
const std::string ClassA::GetNameById(size_t id) const
{
return this->m_stringarray[id];
}
comparefunction tries to cast astringto achar *. That's definitely not a sane thing to do.