Is there a better way to insert an enum into a set without macros? I created an enum for a class and in the constructor I inserted all the enum values into a set.  I am wondering if there is a better way anyone can recommend.  I feel like there should be, but have been unable to think of one or find one online.  I wrote the code in C++ and am using the Boost libraries.

Here is the enum:

class CreateAndUseIniFile {

    std::set&lt;CreateAndUseIniFile::iniFileValues&gt; m_modules;
    enum iniFileValues {
        FIXED_VOLTAGE1,
        FIXED_VOLTAGE2,
        FIXED_VOLTAGE3,
        FIXED_VOLTAGE4
    }
}


and this is the constructor where I add the values

CreateAndUseIniFile::CreateAndUseIniFile() {
    m_modules.insert(CreateAndUseIniFile::FIXED_VOLTAGE1);
    m_modules.insert(CreateAndUseIniFile::FIXED_VOLTAGE2);
    m_modules.insert(CreateAndUseIniFile::FIXED_VOLTAGE3);
    m_modules.insert(CreateAndUseIniFile::FIXED_VOLTAGE4);
}
You can iterate over the enum and insert each one individually.

for ( int i = FIXED_VOLTAGE1; i != FIXED_VOLTAGE4; i++ )
{
    m_modules.insert(CreateAndUseIniFile::static_cast&lt;iniFileValues&gt;(i));
}


Note: This will work with your specific case... don't do this if you have enums with set values that contain gaps between enum values.