diff --git a/lib/base/qstring.h b/lib/base/qstring.h index e085045c3..395f56c8f 100644 --- a/lib/base/qstring.h +++ b/lib/base/qstring.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace icinga { @@ -155,6 +156,20 @@ struct string_iless : std::binary_function } }; +struct pair_string_iless : std::binary_function, std::pair, bool> +{ + bool operator()(const std::pair& p1, const std::pair& p2) const + { + if (string_iless()(p1.first, p2.first)) + return true; + + if (string_iless()(p2.first, p1.first)) + return false; + + return string_iless()(p1.second, p2.second); + } +}; + } namespace boost diff --git a/lib/config/configcompilercontext.h b/lib/config/configcompilercontext.h index f34966eeb..8852bcf94 100644 --- a/lib/config/configcompilercontext.h +++ b/lib/config/configcompilercontext.h @@ -82,9 +82,9 @@ private: int m_Flags; std::vector m_Items; - std::map, ConfigItem::Ptr> m_ItemsMap; + std::map, ConfigItem::Ptr, pair_string_iless> m_ItemsMap; - std::map > m_Types; + std::map, string_iless> m_Types; std::vector m_Errors; diff --git a/lib/config/configitem.h b/lib/config/configitem.h index f91aef108..8b9e8a262 100644 --- a/lib/config/configitem.h +++ b/lib/config/configitem.h @@ -99,7 +99,7 @@ private: static boost::mutex m_Mutex; - typedef std::map, ConfigItem::Ptr> ItemMap; + typedef std::map, ConfigItem::Ptr, pair_string_iless> ItemMap; static ItemMap m_Items; /**< All registered configuration items. */ static ConfigItem::Ptr GetObjectUnlocked(const String& type,