+ use boost::range algorithms for brevity

This commit is contained in:
Artem Pavlenko 2012-02-23 12:10:32 +00:00
parent 9db9e7d161
commit 61c6b7e6b2

View file

@ -30,6 +30,7 @@
// boost
#include <boost/utility.hpp>
#include <boost/unordered_map.hpp>
#include <boost/range/algorithm.hpp>
// stl
#include <vector>
@ -256,7 +257,7 @@ public:
// find closest match based on mean of r,g,b,a
std::vector<rgba>::const_iterator pit =
std::lower_bound(sorted_pal_.begin(), sorted_pal_.end(), c, rgba::mean_sort_cmp());
boost::lower_bound(sorted_pal_, c, rgba::mean_sort_cmp());
ind = pit-sorted_pal_.begin();
if (ind == sorted_pal_.size())
ind--;
@ -331,7 +332,7 @@ public:
root_ = new node();
// sort palette for binary searching in quantization
std::sort(sorted_pal_.begin(), sorted_pal_.end(), rgba::mean_sort_cmp());
boost::sort(sorted_pal_, rgba::mean_sort_cmp());
// returned palette is rearanged, so that colors with a<255 are at the begining
pal_remap_.resize(sorted_pal_.size());