Use std::map rather than vector for memo'izing reason2db.