class Settings
{
private:
typedef std::map<std::string, SettingsOption> OptionMap;
public:
typedef OptionMap::iterator iterator;
typedef OptionMap::const_iterator const_iterator;
...
};
Is this code portable? What does the standard state about it?
It’s legal and
Settings::iteratorandSettings::const_iteratorare accessible to all users of theSettingsclass.Access control in C++ is applied purely to names. There’s a note and example in ISO/IEC 14882:2011 11 [class.access]/4 that makes it clear that this is the intention.