From 33607145a6dc7b11c390dc46edd26cad1149c2e6 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 3 Dec 2014 10:26:21 +0100 Subject: [PATCH] add image_data_null which is cheap to construct (no mem alloc) add default ctor to image_data_any -> image_data_null --- include/mapnik/image_data_any.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/include/mapnik/image_data_any.hpp b/include/mapnik/image_data_any.hpp index dec500225..0c6fe0623 100644 --- a/include/mapnik/image_data_any.hpp +++ b/include/mapnik/image_data_any.hpp @@ -28,7 +28,15 @@ namespace mapnik { -using image_data_base = util::variant; +struct image_data_null +{ + unsigned char const* getBytes() const { return nullptr; } + unsigned char* getBytes() { return nullptr;} + std::size_t width() const { return 0; } + std::size_t height() const { return 0; } +}; + +using image_data_base = util::variant; namespace detail { @@ -72,6 +80,8 @@ struct get_height_visitor : util::static_visitor struct image_data_any : image_data_base { + image_data_any() = default; + template image_data_any(T && data) noexcept : image_data_base(std::move(data)) {}