Browse Source

GCC 4.6 compatibility: no std::unordered_map::emplace().

pull/34/head
Vladimír Vondruš 13 years ago
parent
commit
4048071895
  1. 4
      src/Plugins/MagnumFont/MagnumFont.cpp
  2. 8
      src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp

4
src/Plugins/MagnumFont/MagnumFont.cpp

@ -157,7 +157,11 @@ std::pair<Float, Float> MagnumFont::openInternal(Utility::Configuration&& conf,
for(const Utility::ConfigurationGroup* const c: chars) {
const UnsignedInt glyphId = c->value<UnsignedInt>("glyph");
CORRADE_INTERNAL_ASSERT(glyphId < _opened->glyphAdvance.size());
#ifndef CORRADE_GCC46_COMPATIBILITY
_opened->glyphId.emplace(c->value<char32_t>("unicode"), glyphId);
#else
_opened->glyphId.insert({c->value<char32_t>("unicode"), glyphId});
#endif
}
return {_opened->conf.value<Float>("fontSize"), _opened->conf.value<Float>("lineHeight")};

8
src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp

@ -63,9 +63,17 @@ std::vector<std::pair<std::string, Containers::Array<unsigned char>>> MagnumFont
should stay at position 0 */
std::unordered_map<UnsignedInt, UnsignedInt> glyphIdMap;
glyphIdMap.reserve(cache.glyphCount());
#ifndef CORRADE_GCC46_COMPATIBILITY
glyphIdMap.emplace(0, 0);
#else
glyphIdMap.insert({0, 0});
#endif
for(const std::pair<UnsignedInt, std::pair<Vector2i, Rectanglei>>& glyph: cache)
#ifndef CORRADE_GCC46_COMPATIBILITY
glyphIdMap.emplace(glyph.first, glyphIdMap.size());
#else
glyphIdMap.insert({glyph.first, glyphIdMap.size()});
#endif
/** @todo Save only glyphs contained in @p characters */

Loading…
Cancel
Save