Like this:
To use the weight, you sum up the individual m_Weight members, then generate a random number in range 0 - (sum - 1). Then you walk the vector again and subtract each m_Weight from the generated random number; as soon as it becomes negative, you use that item in the vector.
struct cWeightedEnchantment { int m_Weight; cEnchantments m_Enchantments; }; typedef std::vector<cWeightedEnchantment> cWeightedEnchantments;
To use the weight, you sum up the individual m_Weight members, then generate a random number in range 0 - (sum - 1). Then you walk the vector again and subtract each m_Weight from the generated random number; as soon as it becomes negative, you use that item in the vector.