From ca8366d5ee2aa2be7b9258b5dfc0d840f2bb86ca Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Sat, 24 Dec 2022 01:41:50 -0300 Subject: [PATCH] Fix pair_sorter_finder for rstl::sort --- include/rstl/algorithm.hpp | 8 ++++++++ src/Kyoto/Text/CRasterFont.cpp | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/rstl/algorithm.hpp b/include/rstl/algorithm.hpp index 3d159822..ce3780f7 100644 --- a/include/rstl/algorithm.hpp +++ b/include/rstl/algorithm.hpp @@ -143,6 +143,8 @@ public: /* { return cmp(a.first, b); }*/ + + bool operator()(const pair< K, V >& a, const pair< K, V >& b) const; }; template @@ -165,6 +167,12 @@ inline bool pair_sorter_finder< pair< K, V >, Cmp >::operator()(const pair< K, V return cmp(a.first, b); } +template < typename K, typename V, typename Cmp > +inline bool pair_sorter_finder< pair< K, V >, Cmp >::operator()(const pair< K, V >& a, + const pair< K, V >& b) const { + return cmp(a.first, b.first); +} + template < typename T > typename T::const_iterator find_by_key(const T& container, diff --git a/src/Kyoto/Text/CRasterFont.cpp b/src/Kyoto/Text/CRasterFont.cpp index f08d3985..e306c455 100644 --- a/src/Kyoto/Text/CRasterFont.cpp +++ b/src/Kyoto/Text/CRasterFont.cpp @@ -65,8 +65,9 @@ CRasterFont::CRasterFont(CInputStream& in, IObjectStore* store) rstl::pair< wchar_t, CGlyph >(chr, CGlyph(a, b, c, startU, startV, endU, endV, cellWidth, cellHeight, baseline, kernStart))); } - //rstl::sort(xc_glyphs.begin(), xc_glyphs.end(), - // rstl::pair_sorter_finder< wchar_t, CGlyph, rstl::less< wchar_t > >()); + rstl::sort( + xc_glyphs.begin(), xc_glyphs.end(), + rstl::default_pair_sorter_finder< rstl::vector< rstl::pair< wchar_t, CGlyph > > >()); } } }