diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx index 251137b92485..f5c58fd15190 100644 --- a/include/comphelper/stl_types.hxx +++ b/include/comphelper/stl_types.hxx @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -86,6 +87,19 @@ public: } }; +/// by-value less functor for std::set> +template struct UniquePtrValueLess + : public ::std::binary_function, std::unique_ptr, bool> +{ + bool operator()(std::unique_ptr const& lhs, + std::unique_ptr const& rhs) const + { + assert(lhs.get()); + assert(rhs.get()); + return (*lhs) < (*rhs); + } +}; + /** STL-compliant structure for comparing Reference< <iface> > instances */ template < class IAFCE > diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx index 5c256e8af544..42328e01127c 100644 --- a/include/filter/msfilter/msdffimp.hxx +++ b/include/filter/msfilter/msdffimp.hxx @@ -31,6 +31,8 @@ #include #include +#include + #include #include #include @@ -266,15 +268,9 @@ private: SvxMSDffImportRec &operator=(const SvxMSDffImportRec&) SAL_DELETED_FUNCTION; }; -struct MSDffImportRecords_Less -{ - bool operator()(std::unique_ptr const& left, - std::unique_ptr const& right) const - { return (*left) < (*right); } -}; /** list of all SvxMSDffImportRec instances of/for a group */ -typedef std::set, MSDffImportRecords_Less> - MSDffImportRecords; +typedef std::set, + comphelper::UniquePtrValueLess> MSDffImportRecords; /** block of parameters for import/export for a single call of ImportObjAtCurrentStreamPos() */ diff --git a/sw/source/core/inc/blink.hxx b/sw/source/core/inc/blink.hxx index 6c14225dadfa..8b9fc5d2d10a 100644 --- a/sw/source/core/inc/blink.hxx +++ b/sw/source/core/inc/blink.hxx @@ -26,6 +26,7 @@ class SwTextFrm; #include #include +#include #include #include @@ -63,16 +64,8 @@ public: { return reinterpret_cast(pPor) == reinterpret_cast(rBlinkPortion.pPor); } }; -struct SwBlinkPortion_Less -{ - bool operator()(std::unique_ptr const& lhs, - std::unique_ptr const& rhs) - { - return (*lhs) < (*rhs); - } -}; - -typedef std::set, SwBlinkPortion_Less> SwBlinkSet; +typedef std::set, + comphelper::UniquePtrValueLess> SwBlinkSet; class SwBlink { diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index df11e3eb00d1..f0323295351b 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "shellio.hxx" @@ -262,16 +263,8 @@ struct SwHTMLFormatInfo }; -struct SwHTMLFormatInfo_Less -{ - bool operator()(std::unique_ptr const& lhs, - std::unique_ptr const& rhs) - { - return (*lhs) < (*rhs); - } -}; - -typedef std::set, SwHTMLFormatInfo_Less> SwHTMLFormatInfos; +typedef std::set, + comphelper::UniquePtrValueLess> SwHTMLFormatInfos; class IDocumentStylePoolAccess; diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx index 4dbce494ac74..d7a8240e7c3b 100644 --- a/xmloff/source/style/impastpl.hxx +++ b/xmloff/source/style/impastpl.hxx @@ -28,6 +28,9 @@ #include #include #include + +#include + #include #include @@ -102,15 +105,8 @@ public: struct XMLAutoStyleFamily : boost::noncopyable { - struct XMLAutoStylePoolParent_Less - { - bool operator()(std::unique_ptr const& lhs, - std::unique_ptr const& rhs) const - { - return (*lhs) < (*rhs); - } - }; - typedef std::set, XMLAutoStylePoolParent_Less> ParentSetType; + typedef std::set, + comphelper::UniquePtrValueLess> ParentSetType; typedef std::set NameSetType; sal_uInt32 mnFamily; @@ -140,16 +136,9 @@ struct XMLAutoStyleFamily : boost::noncopyable class SvXMLAutoStylePoolP_Impl { - struct XMLAutoStyleFamily_Less - { - bool operator()(std::unique_ptr const& lhs, - std::unique_ptr const& rhs) const - { - return (*lhs) < (*rhs); - } - }; // A set that finds and sorts based only on mnFamily - typedef std::set, XMLAutoStyleFamily_Less> FamilySetType; + typedef std::set, + comphelper::UniquePtrValueLess> FamilySetType; SvXMLExport& rExport; FamilySetType m_FamilySet;