even better, use BOOST_FOREACH

This commit is contained in:
Artem Pavlenko 2012-03-19 10:46:44 +00:00
parent aef214292e
commit e06c456789

View file

@ -46,6 +46,7 @@ extern "C"
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp>
#ifdef MAPNIK_THREADSAFE #ifdef MAPNIK_THREADSAFE
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#endif #endif
@ -168,12 +169,10 @@ public:
glyph_ptr get_glyph(unsigned c) const glyph_ptr get_glyph(unsigned c) const
{ {
std::vector<face_ptr>::const_iterator face = faces_.begin(); BOOST_FOREACH ( face_ptr const& face, faces_)
std::vector<face_ptr>::const_iterator end = faces_.end();
for (; face != end; ++face)
{ {
FT_UInt g = (*face)->get_char(c); FT_UInt g = face->get_char(c);
if (g) return boost::make_shared<font_glyph>(*face, g); if (g) return boost::make_shared<font_glyph>(face, g);
} }
// Final fallback to empty square if nothing better in any font // Final fallback to empty square if nothing better in any font
@ -186,17 +185,17 @@ public:
void set_pixel_sizes(unsigned size) void set_pixel_sizes(unsigned size)
{ {
for (std::vector<face_ptr>::iterator face = faces_.begin(); face != faces_.end(); ++face) BOOST_FOREACH ( face_ptr const& face, faces_)
{ {
(*face)->set_pixel_sizes(size); face->set_pixel_sizes(size);
} }
} }
void set_character_sizes(float size) void set_character_sizes(float size)
{ {
for (std::vector<face_ptr>::iterator face = faces_.begin(); face != faces_.end(); ++face) BOOST_FOREACH ( face_ptr const& face, faces_)
{ {
(*face)->set_character_sizes(size); face->set_character_sizes(size);
} }
} }
private: private: