diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-12-03 11:27:24 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-12-03 11:27:24 +0100 |
commit | 82f3574d09064a442e30eb2dc7639f473749c5bd (patch) | |
tree | dfb0aa6182a0d7d04b6131199d67ff90a87cb9c1 | |
parent | 50669307c5648e62941a63e0c75dba8602448d9d (diff) | |
download | qtlocation-mapboxgl-82f3574d09064a442e30eb2dc7639f473749c5bd.tar.gz |
add array overloads to make_unique and move it to mbgl::util from std
-rw-r--r-- | include/mbgl/platform/log.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/util/std.hpp | 27 | ||||
-rw-r--r-- | platform/darwin/http_request_baton_cocoa.mm | 6 | ||||
-rw-r--r-- | platform/darwin/image.mm | 3 | ||||
-rw-r--r-- | platform/default/headless_view.cpp | 6 | ||||
-rw-r--r-- | platform/default/http_request_baton_curl.cpp | 5 | ||||
-rw-r--r-- | platform/default/image.cpp | 3 | ||||
-rw-r--r-- | platform/default/image_reader.cpp | 4 | ||||
-rw-r--r-- | src/map/map.cpp | 12 | ||||
-rw-r--r-- | src/map/source.cpp | 2 | ||||
-rw-r--r-- | src/map/sprite.cpp | 2 | ||||
-rw-r--r-- | src/map/tile_parser.cpp | 10 | ||||
-rw-r--r-- | src/renderer/painter.cpp | 24 | ||||
-rw-r--r-- | src/storage/base_request.cpp | 3 | ||||
-rw-r--r-- | src/storage/file_request_baton.cpp | 7 | ||||
-rw-r--r-- | src/storage/file_source.cpp | 3 | ||||
-rw-r--r-- | src/storage/sqlite_store.cpp | 3 | ||||
-rw-r--r-- | src/style/style.cpp | 2 | ||||
-rw-r--r-- | src/style/style_parser.cpp | 2 | ||||
-rw-r--r-- | src/text/glyph_store.cpp | 4 | ||||
-rw-r--r-- | src/util/raster.cpp | 2 |
21 files changed, 80 insertions, 54 deletions
diff --git a/include/mbgl/platform/log.hpp b/include/mbgl/platform/log.hpp index 406b3eea37..418160d3ee 100644 --- a/include/mbgl/platform/log.hpp +++ b/include/mbgl/platform/log.hpp @@ -3,6 +3,8 @@ #include "event.hpp" +#include <mbgl/util/std.hpp> + #include <memory> #include <string> @@ -58,7 +60,7 @@ public: template<typename T, typename ...Args> static inline const T &Set(Args&& ...args) { - Backend = ::std::unique_ptr<T>(new T(::std::forward<Args>(args)...)); + Backend = util::make_unique<T>(::std::forward<Args>(args)...); return *dynamic_cast<T *>(Backend.get()); } diff --git a/include/mbgl/util/std.hpp b/include/mbgl/util/std.hpp index 051f89bb60..e64820de47 100644 --- a/include/mbgl/util/std.hpp +++ b/include/mbgl/util/std.hpp @@ -2,19 +2,34 @@ #define MBGL_UTIL_STD #include <memory> +#include <type_traits> +#include <utility> -namespace std { +namespace mbgl { +namespace util { + +// C++14 backfill based on http://llvm.org/svn/llvm-project/libcxx/trunk/include/memory + +namespace detail { +template<class T> struct unique_type { typedef ::std::unique_ptr<T> single; }; +template<class T> struct unique_type<T[]> { typedef ::std::unique_ptr<T[]> unknown_bound; }; +template<class T, size_t size> struct unique_type<T[size]> { typedef void known_bound; }; +} -// C++14 backfill from http://herbsutter.com/gotw/_102/ -template<typename T, typename ...Args> -::std::unique_ptr<T> make_unique(Args&& ...args) { +template<class T, class... Args> +typename detail::unique_type<T>::single make_unique(Args&&... args) { return ::std::unique_ptr<T>(new T(::std::forward<Args>(args)...)); } +template<class T> +typename detail::unique_type<T>::unknown_bound make_unique(size_t size) { + return ::std::unique_ptr<T>(new typename ::std::remove_extent<T>::type[size]()); } -namespace mbgl { -namespace util { +template<class T, class... Args> +typename detail::unique_type<T>::known_bound make_unique(Args&&...) = delete; + + template <typename Container, typename ForwardIterator, typename Predicate> void erase_if(Container &container, ForwardIterator it, const ForwardIterator end, Predicate pred) { diff --git a/platform/darwin/http_request_baton_cocoa.mm b/platform/darwin/http_request_baton_cocoa.mm index 03fa3bb821..28afbb5086 100644 --- a/platform/darwin/http_request_baton_cocoa.mm +++ b/platform/darwin/http_request_baton_cocoa.mm @@ -51,7 +51,7 @@ void HTTPRequestBaton::start(const util::ptr<HTTPRequestBaton> &ptr) { } else { // TODO: Use different codes for host not found, timeout, invalid URL etc. // These can be categorized in temporary and permanent errors. - baton->response = std::make_unique<Response>(); + baton->response = util::make_unique<Response>(); baton->response->code = [(NSHTTPURLResponse *)res statusCode]; baton->response->message = [[error localizedDescription] UTF8String]; @@ -86,7 +86,7 @@ void HTTPRequestBaton::start(const util::ptr<HTTPRequestBaton> &ptr) { // Assume a Response object already exists. assert(baton->response); } else { - baton->response = std::make_unique<Response>(); + baton->response = util::make_unique<Response>(); baton->response->code = code; baton->response->data = {(const char *)[data bytes], [data length]}; } @@ -117,7 +117,7 @@ void HTTPRequestBaton::start(const util::ptr<HTTPRequestBaton> &ptr) { } else { // This should never happen. baton->type = HTTPResponseType::PermanentError; - baton->response = std::make_unique<Response>(); + baton->response = util::make_unique<Response>(); baton->response->code = -1; baton->response->message = "response class is not NSHTTPURLResponse"; } diff --git a/platform/darwin/image.mm b/platform/darwin/image.mm index b8df3c403e..4819d2cd3c 100644 --- a/platform/darwin/image.mm +++ b/platform/darwin/image.mm @@ -1,4 +1,5 @@ #include <mbgl/util/image.hpp> +#include <mbgl/util/std.hpp> #import <ImageIO/ImageIO.h> @@ -97,7 +98,7 @@ Image::Image(const std::string &source_data) { height = uint32_t(CGImageGetHeight(image)); CGRect rect = {{ 0, 0 }, { static_cast<CGFloat>(width), static_cast<CGFloat>(height) }}; - img = ::std::unique_ptr<char[]>(new char[width * height * 4]()); + img = util::make_unique<char[]>(width * height * 4); CGContextRef context = CGBitmapContextCreate(img.get(), width, height, 8, width * 4, color_space, kCGImageAlphaPremultipliedLast); if (!context) { diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp index 10d6ed8f42..5b95c76026 100644 --- a/platform/default/headless_view.cpp +++ b/platform/default/headless_view.cpp @@ -1,6 +1,8 @@ #include <mbgl/platform/default/headless_view.hpp> #include <mbgl/platform/default/headless_display.hpp> +#include <mbgl/util/std.hpp> + #include <stdexcept> #include <sstream> #include <string> @@ -232,14 +234,14 @@ std::unique_ptr<uint32_t[]> HeadlessView::readPixels() { const unsigned int w = width_ * pixelRatio_; const unsigned int h = height_ * pixelRatio_; - auto pixels = std::unique_ptr<uint32_t[]>(new uint32_t[w * h]); + auto pixels = util::make_unique<uint32_t[]>(w * h); make_active(); glReadPixels(0, 0, width_, height_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); make_inactive(); const int stride = w * 4; - auto tmp = std::unique_ptr<char[]>(new char[stride]()); + auto tmp = util::make_unique<char[]>(stride); char *rgba = reinterpret_cast<char *>(pixels.get()); for (int i = 0, j = height_ - 1; i < j; i++, j--) { std::memcpy(tmp.get(), rgba + i * stride, stride); diff --git a/platform/default/http_request_baton_curl.cpp b/platform/default/http_request_baton_curl.cpp index 02e9497c9e..4b825622ae 100644 --- a/platform/default/http_request_baton_curl.cpp +++ b/platform/default/http_request_baton_curl.cpp @@ -2,6 +2,7 @@ #include <mbgl/util/uv-messenger.h> #include <mbgl/util/time.hpp> #include <mbgl/util/string.hpp> +#include <mbgl/util/std.hpp> #include <uv.h> #include <curl/curl.h> @@ -114,7 +115,7 @@ struct Context { CURLMcode error = curl_multi_remove_handle(multi, handle); if (error != CURLM_OK) { - baton->response = std::unique_ptr<Response>(new Response()); + baton->response = util::make_unique<Response>(); baton->response->code = -1; baton->response->message = curl_multi_strerror(error); } @@ -429,7 +430,7 @@ void start_request(void *const ptr) { } if (!context->baton->response) { - context->baton->response = std::unique_ptr<Response>(new Response()); + context->baton->response = util::make_unique<Response>(); } // Carry on the shared pointer in the private information of the CURL handle. diff --git a/platform/default/image.cpp b/platform/default/image.cpp index 242367e889..d881b9231c 100644 --- a/platform/default/image.cpp +++ b/platform/default/image.cpp @@ -1,5 +1,6 @@ #include <mbgl/util/image.hpp> #include <mbgl/util/string.hpp> +#include <mbgl/util/std.hpp> #include <png.h> @@ -80,7 +81,7 @@ Image::Image(std::string const& data) auto reader = getImageReader(data.c_str(), data.size()); width = reader->width(); height = reader->height(); - img = ::std::unique_ptr<char[]>(new char[width * height * 4]()); + img = util::make_unique<char[]>(width * height * 4); reader->read(0, 0, width, height, img.get()); } catch (ImageReaderException const& ex) diff --git a/platform/default/image_reader.cpp b/platform/default/image_reader.cpp index e80ccb6819..fc6daec6a5 100644 --- a/platform/default/image_reader.cpp +++ b/platform/default/image_reader.cpp @@ -49,11 +49,11 @@ std::unique_ptr<ImageReader> getImageReader(char const* data, size_t size) { if (*type == "png") { - return std::make_unique<PngReader<boost::iostreams::array_source>>(data, size); + return util::make_unique<PngReader<boost::iostreams::array_source>>(data, size); } else if (*type == "jpeg") { - return std::make_unique<JpegReader<boost::iostreams::array_source>>(data, size); + return util::make_unique<JpegReader<boost::iostreams::array_source>>(data, size); } } throw ImageReaderException("ImageReader: can't determine type from input data"); diff --git a/src/map/map.cpp b/src/map/map.cpp index b3c83d1be6..cc22e048f7 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -86,7 +86,7 @@ const static bool sqlite_version_check = []() { using namespace mbgl; Map::Map(View& view_) - : loop(std::make_unique<uv::loop>()), + : loop(util::make_unique<uv::loop>()), view(view_), #ifndef NDEBUG mainThread(uv_thread_self()), @@ -123,7 +123,7 @@ Map::~Map() { uv::worker &Map::getWorker() { if (!workers) { - workers = std::make_unique<uv::worker>(**loop, 4, "Tile Worker"); + workers = util::make_unique<uv::worker>(**loop, 4, "Tile Worker"); } return *workers; } @@ -140,7 +140,7 @@ void Map::start() { isStopped = false; // Setup async notifications - asyncTerminate = std::make_unique<uv::async>(**loop, [this]() { + asyncTerminate = util::make_unique<uv::async>(**loop, [this]() { assert(uv_thread_self() == mapThread); // Remove all of these to make sure they are destructed in the correct thread. @@ -156,7 +156,7 @@ void Map::start() { asyncTerminate.reset(); }); - asyncRender = std::make_unique<uv::async>(**loop, [this]() { + asyncRender = util::make_unique<uv::async>(**loop, [this]() { assert(uv_thread_self() == mapThread); if (state.hasSize()) { @@ -175,11 +175,11 @@ void Map::start() { } }); - asyncCleanup = std::make_unique<uv::async>(**loop, [this]() { + asyncCleanup = util::make_unique<uv::async>(**loop, [this]() { painter.cleanup(); }); - thread = std::make_unique<uv::thread>([this]() { + thread = util::make_unique<uv::thread>([this]() { #ifndef NDEBUG mapThread = uv_thread_self(); #endif diff --git a/src/map/source.cpp b/src/map/source.cpp index 8737e38757..35f5072860 100644 --- a/src/map/source.cpp +++ b/src/map/source.cpp @@ -164,7 +164,7 @@ TileData::State Source::addTile(Map& map, uv::worker& worker, return state; } - auto pos = tiles.emplace(id, std::make_unique<Tile>(id)); + auto pos = tiles.emplace(id, util::make_unique<Tile>(id)); Tile& new_tile = *pos.first->second; // We couldn't find the tile in the list. Create a new one. diff --git a/src/map/sprite.cpp b/src/map/sprite.cpp index 82073619d4..c1f71e59d9 100644 --- a/src/map/sprite.cpp +++ b/src/map/sprite.cpp @@ -101,7 +101,7 @@ bool Sprite::isLoaded() const { } void Sprite::parseImage() { - raster = std::make_unique<util::Image>(image); + raster = util::make_unique<util::Image>(image); if (!*raster) { raster.reset(); } diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index 8f55326787..cbfd6fa7b3 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -44,7 +44,7 @@ TileParser::TileParser(const std::string &data, VectorTileData &tile_, spriteAtlas(spriteAtlas_), sprite(sprite_), texturePool(texturePool_), - collision(std::make_unique<Collision>(tile.id.z, 4096, tile.source.tile_size, tile.depth)) { + collision(util::make_unique<Collision>(tile.id.z, 4096, tile.source.tile_size, tile.depth)) { assert(&tile != nullptr); assert(style); assert(sprite); @@ -150,24 +150,24 @@ void TileParser::addBucketGeometries(Bucket& bucket, const VectorTileLayer& laye } std::unique_ptr<Bucket> TileParser::createFillBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketFill &fill) { - std::unique_ptr<FillBucket> bucket = std::make_unique<FillBucket>(tile.fillVertexBuffer, tile.triangleElementsBuffer, tile.lineElementsBuffer, fill); + std::unique_ptr<FillBucket> bucket = util::make_unique<FillBucket>(tile.fillVertexBuffer, tile.triangleElementsBuffer, tile.lineElementsBuffer, fill); addBucketGeometries(bucket, layer, filter); return obsolete() ? nullptr : std::move(bucket); } std::unique_ptr<Bucket> TileParser::createRasterBucket(const StyleBucketRaster &raster) { - std::unique_ptr<RasterBucket> bucket = std::make_unique<RasterBucket>(texturePool, raster); + std::unique_ptr<RasterBucket> bucket = util::make_unique<RasterBucket>(texturePool, raster); return obsolete() ? nullptr : std::move(bucket); } std::unique_ptr<Bucket> TileParser::createLineBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketLine &line) { - std::unique_ptr<LineBucket> bucket = std::make_unique<LineBucket>(tile.lineVertexBuffer, tile.triangleElementsBuffer, tile.pointElementsBuffer, line); + std::unique_ptr<LineBucket> bucket = util::make_unique<LineBucket>(tile.lineVertexBuffer, tile.triangleElementsBuffer, tile.pointElementsBuffer, line); addBucketGeometries(bucket, layer, filter); return obsolete() ? nullptr : std::move(bucket); } std::unique_ptr<Bucket> TileParser::createSymbolBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketSymbol &symbol) { - std::unique_ptr<SymbolBucket> bucket = std::make_unique<SymbolBucket>(symbol, *collision); + std::unique_ptr<SymbolBucket> bucket = util::make_unique<SymbolBucket>(symbol, *collision); bucket->addFeatures(layer, filter, tile.id, spriteAtlas, *sprite, glyphAtlas, glyphStore); return obsolete() ? nullptr : std::move(bucket); } diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp index 3b4e817d33..15bf9e3a0d 100644 --- a/src/renderer/painter.cpp +++ b/src/renderer/painter.cpp @@ -89,18 +89,18 @@ void Painter::setup() { } void Painter::setupShaders() { - if (!plainShader) plainShader = std::make_unique<PlainShader>(); - if (!outlineShader) outlineShader = std::make_unique<OutlineShader>(); - if (!lineShader) lineShader = std::make_unique<LineShader>(); - if (!linejoinShader) linejoinShader = std::make_unique<LinejoinShader>(); - if (!linepatternShader) linepatternShader = std::make_unique<LinepatternShader>(); - if (!patternShader) patternShader = std::make_unique<PatternShader>(); - if (!iconShader) iconShader = std::make_unique<IconShader>(); - if (!rasterShader) rasterShader = std::make_unique<RasterShader>(); - if (!sdfGlyphShader) sdfGlyphShader = std::make_unique<SDFGlyphShader>(); - if (!sdfIconShader) sdfIconShader = std::make_unique<SDFIconShader>(); - if (!dotShader) dotShader = std::make_unique<DotShader>(); - if (!gaussianShader) gaussianShader = std::make_unique<GaussianShader>(); + if (!plainShader) plainShader = util::make_unique<PlainShader>(); + if (!outlineShader) outlineShader = util::make_unique<OutlineShader>(); + if (!lineShader) lineShader = util::make_unique<LineShader>(); + if (!linejoinShader) linejoinShader = util::make_unique<LinejoinShader>(); + if (!linepatternShader) linepatternShader = util::make_unique<LinepatternShader>(); + if (!patternShader) patternShader = util::make_unique<PatternShader>(); + if (!iconShader) iconShader = util::make_unique<IconShader>(); + if (!rasterShader) rasterShader = util::make_unique<RasterShader>(); + if (!sdfGlyphShader) sdfGlyphShader = util::make_unique<SDFGlyphShader>(); + if (!sdfIconShader) sdfIconShader = util::make_unique<SDFIconShader>(); + if (!dotShader) dotShader = util::make_unique<DotShader>(); + if (!gaussianShader) gaussianShader = util::make_unique<GaussianShader>(); } void Painter::deleteShaders() { diff --git a/src/storage/base_request.cpp b/src/storage/base_request.cpp index e87679ae1b..9819dc89f1 100644 --- a/src/storage/base_request.cpp +++ b/src/storage/base_request.cpp @@ -1,6 +1,7 @@ #include <mbgl/storage/base_request.hpp> #include <mbgl/storage/response.hpp> #include <mbgl/storage/request.hpp> +#include <mbgl/util/std.hpp> #include <uv.h> @@ -68,7 +69,7 @@ Callback *BaseRequest::add(Callback &&callback, const util::ptr<BaseRequest> &re return nullptr; } else { self = request; - callbacks.push_front(std::unique_ptr<Callback>(new Callback(std::move(callback)))); + callbacks.push_front(util::make_unique<Callback>(std::move(callback))); return callbacks.front().get(); } } diff --git a/src/storage/file_request_baton.cpp b/src/storage/file_request_baton.cpp index 1b41a53706..75ea95df41 100644 --- a/src/storage/file_request_baton.cpp +++ b/src/storage/file_request_baton.cpp @@ -1,6 +1,7 @@ #include <mbgl/storage/file_request_baton.hpp> #include <mbgl/storage/file_request.hpp> #include <mbgl/storage/response.hpp> +#include <mbgl/util/std.hpp> #include <limits> @@ -29,7 +30,7 @@ void FileRequestBaton::notify_error(uv_fs_t *req) { assert(ptr->thread_id == uv_thread_self()); if (ptr->request && req->result < 0 && !ptr->canceled && req->result != UV_ECANCELED) { - ptr->request->response = std::unique_ptr<Response>(new Response); + ptr->request->response = util::make_unique<Response>(); ptr->request->response->code = req->result == UV_ENOENT ? 404 : 500; #if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 ptr->request->response->message = uv_strerror(uv_last_error(req->loop)); @@ -86,7 +87,7 @@ void FileRequestBaton::file_stated(uv_fs_t *req) { // File is too large for us to open this way because uv_buf's only support unsigned // ints as maximum size. if (ptr->request) { - ptr->request->response = std::unique_ptr<Response>(new Response); + ptr->request->response = util::make_unique<Response>(); ptr->request->response->code = UV_EFBIG; #if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 ptr->request->response->message = uv_strerror(uv_err_t {UV_EFBIG, 0}); @@ -123,7 +124,7 @@ void FileRequestBaton::file_read(uv_fs_t *req) { } else { // File was successfully read. if (ptr->request) { - ptr->request->response = std::unique_ptr<Response>(new Response); + ptr->request->response = util::make_unique<Response>(); ptr->request->response->code = 200; ptr->request->response->data = std::move(ptr->body); ptr->request->notify(); diff --git a/src/storage/file_source.cpp b/src/storage/file_source.cpp index a67f57dac4..d1e4c8f38d 100644 --- a/src/storage/file_source.cpp +++ b/src/storage/file_source.cpp @@ -3,6 +3,7 @@ #include <mbgl/storage/http_request.hpp> #include <mbgl/storage/sqlite_store.hpp> #include <mbgl/util/uv-messenger.h> +#include <mbgl/util/std.hpp> #include <uv.h> @@ -79,7 +80,7 @@ std::unique_ptr<Request> FileSource::request(ResourceType type, const std::strin pending.emplace(absoluteURL, req); } - return std::unique_ptr<Request>(new Request(req)); + return util::make_unique<Request>(req); } void FileSource::prepare(std::function<void()> fn) { diff --git a/src/storage/sqlite_store.cpp b/src/storage/sqlite_store.cpp index e0757ecc36..bc262e386a 100644 --- a/src/storage/sqlite_store.cpp +++ b/src/storage/sqlite_store.cpp @@ -1,6 +1,7 @@ #include <mbgl/storage/sqlite_store.hpp> #include <mbgl/util/compression.hpp> #include <mbgl/util/sqlite3.hpp> +#include <mbgl/util/std.hpp> #include <mbgl/util/uv-worker.h> @@ -127,7 +128,7 @@ void SQLiteStore::get(const std::string &path, GetCallback callback, void *ptr) stmt.bind(1, url.c_str()); if (stmt.run()) { // There is data. - baton->response = std::unique_ptr<Response>(new Response); + baton->response = util::make_unique<Response>(); baton->response->code = stmt.get<int>(0); baton->type = ResourceType(stmt.get<int>(1)); diff --git a/src/style/style.cpp b/src/style/style.cpp index 030c502089..15ca4e14fb 100644 --- a/src/style/style.cpp +++ b/src/style/style.cpp @@ -17,7 +17,7 @@ namespace mbgl { Style::Style() - : mtx(std::make_unique<uv::rwlock>()) { + : mtx(util::make_unique<uv::rwlock>()) { } // Note: This constructor is seemingly empty, but we need to declare it anyway diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp index 22d43df443..2dec648aff 100644 --- a/src/style/style_parser.cpp +++ b/src/style/style_parser.cpp @@ -449,7 +449,7 @@ bool StyleParser::parseOptionalProperty(const char *property_name, const std::ve std::unique_ptr<StyleLayerGroup> StyleParser::createLayers(JSVal value) { if (value.IsArray()) { - std::unique_ptr<StyleLayerGroup> group = std::make_unique<StyleLayerGroup>(); + std::unique_ptr<StyleLayerGroup> group = util::make_unique<StyleLayerGroup>(); for (rapidjson::SizeType i = 0; i < value.Size(); ++i) { util::ptr<StyleLayer> layer = createLayer(value[i]); if (layer) { diff --git a/src/text/glyph_store.cpp b/src/text/glyph_store.cpp index 737bad35d8..8537ab5156 100644 --- a/src/text/glyph_store.cpp +++ b/src/text/glyph_store.cpp @@ -271,7 +271,7 @@ std::shared_future<GlyphPBF &> GlyphStore::loadGlyphRange(const std::string &fon auto range_it = rangeSets.find(range); if (range_it == rangeSets.end()) { // We don't have this glyph set yet for this font stack. - range_it = rangeSets.emplace(range, std::make_unique<GlyphPBF>(glyphURL, fontStack, range, fileSource)).first; + range_it = rangeSets.emplace(range, util::make_unique<GlyphPBF>(glyphURL, fontStack, range, fileSource)).first; } return range_it->second->getFuture(); @@ -280,7 +280,7 @@ std::shared_future<GlyphPBF &> GlyphStore::loadGlyphRange(const std::string &fon FontStack &GlyphStore::createFontStack(const std::string &fontStack) { auto stack_it = stacks.find(fontStack); if (stack_it == stacks.end()) { - stack_it = stacks.emplace(fontStack, std::make_unique<FontStack>()).first; + stack_it = stacks.emplace(fontStack, util::make_unique<FontStack>()).first; } return *stack_it->second.get(); } diff --git a/src/util/raster.cpp b/src/util/raster.cpp index 66c5c13fea..56461aec5f 100644 --- a/src/util/raster.cpp +++ b/src/util/raster.cpp @@ -27,7 +27,7 @@ bool Raster::isLoaded() const { } bool Raster::load(const std::string &data) { - img = std::make_unique<util::Image>(data); + img = util::make_unique<util::Image>(data); width = img->getWidth(); height = img->getHeight(); |