I may be mistaken, but your first iteration of convert2roman seemed to work. I actually found the solution clever too.

When you write functions like convert2roman, it is usually pretty easy to get them to work for valid input. The hard implementation is the one that tells you when it fails.

Anyways, here is a wikipedia inspired implementation:
Code:
#include <iostream>
#include <string>

int roman_2_decimal(const std::string& i_string)
{
  static const std::string roman[]   = {"M", "CM", "CD", "D", "C", "XC", "XL", "L", "X", "IX", "IV", "V", "I"};
  static const int decimal[] = { 1000, 900, 400, 500, 100, 90, 40, 50, 10, 9, 4, 5, 1};
  static const size_t size = sizeof(decimal)/sizeof(decimal[0]);

  int value = 0;
  size_t index = 0;
  for(int i = 0; i<size; ++i)
  {
    while(i_string.substr(index, roman[i].length()) == roman[i])
    {
      value += decimal[i];
      index += roman[i].length();
    }
  }
  return value;
}

int main()
{
  std::cout << "MCXIV" << ": " << roman_2_decimal("MCXIV") << std::endl;
  std::cout << "CCCLIX" << ": " << roman_2_decimal("CCCLIX") << std::endl;
  std::cout << "MDCLXVI" << ": " << roman_2_decimal("MDCLXVI") << std::endl;
}