Can you tell me why the "netDefaults.insert(...)" line causes the C++ compilation errors shown below? I'm using Visual Studio 2003. The code shown below is enclosed in an anonymous namespace to restrict its scope to the local file. Everything compiles fine if I comment out the "netDefaults.insert(,,,)" line. I use the make_pair() macro elsewhere (with different typed arguments) and it works fine in those other places. Note that those other places are outside the anonymous namespace.

Getting rid of the anonymous namespace makes no difference. Removing the const modifier on the netDefaults declaration makes no difference. Adding "const EnumPrefIndicator" to the TDefaultSettingsMap declaration makes no difference.

Code:
  typedef struct _TPrefInfo
    {
    EnumSimpleType    dataType;
    void*             pDefaultValue;

    _TPrefInfo( EnumSimpleType type, void *pData ) : dataType( type ), pDefaultValue( pData ){};
    } TPrefInfo;

  typedef std::map< EnumPrefIndicator, TPrefInfo* > TDefaultSettingsMap;

  const TDefaultSettingsMap netDefaults;

  // Populate the default settings...
    // IPS.

--> netDefaults.insert( make_pair( prefIpsStatusModeNipsStatus, new TPrefInfo( stBool, (void*)true ) ) );



Prefs.cpp
c:\MyDocs\Entercept\netprefs_new\NetPrefs\prefs\Pr efs.cpp(121) : error C2143: syntax error : missing ';' before '.'

c:\MyDocs\Entercept\netprefs_new\NetPrefs\prefs\Pr efs.cpp(121) : error C2501: 'netDefaults' : missing storage-class or type specifiers

c:\MyDocs\Entercept\netprefs_new\NetPrefs\prefs\Pr efs.cpp(121) : error C2373: '`anonymous-namespace'::netDefaults' : redefinition; different type modifiers

c:\MyDocs\Entercept\netprefs_new\NetPrefs\prefs\Pr efs.cpp(114) : see declaration of '`anonymous-namespace'::netDefaults'