From: Willem Jan Withagen Date: Sun, 19 Feb 2017 11:57:32 +0000 (+0100) Subject: include/mempool.h: fix Clangs complaint about types X-Git-Tag: v12.0.1~232^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c4b100cdfb1f9c04bd19ed028eade389e874bf97;p=ceph.git include/mempool.h: fix Clangs complaint about types - Clang generates the following error: In file included from /home/jenkins/workspace/ceph-master/src/test/objectstore/store_test.cc:21: In file included from /home/jenkins/workspace/ceph-master/src/os/ObjectStore.h:17: In file included from /home/jenkins/workspace/ceph-master/src/include/Context.h:19: In file included from /home/jenkins/workspace/ceph-master/src/common/dout.h:20: In file included from /home/jenkins/workspace/ceph-master/src/common/config.h:21: /usr/include/c++/v1/map:820:5: error: static_assert failed "Allocator::value_type must be same type as value_type" static_assert((is_same::value), ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/jenkins/workspace/ceph-master/src/os/bluestore/bluestore_types.h:204:9: note: in instantiation of template class 'std::__1::map, mempool::pool_allocator > >' requested here map_t ref_map; This is fixed by make the K in std::pair a const. - Based on the C++ we should use pair as the value type of allocator as per C++ standard par. 23.4.4.1, n3337. namespace std { template , class Allocator = allocator > > class map { public: // types: typedef Key key_type; typedef T mapped_type; typedef pair value_type; // ... }; Signed-off-by: Willem Jan Withagen --- diff --git a/src/include/mempool.h b/src/include/mempool.h index 7b4a59618e5..109da704c88 100644 --- a/src/include/mempool.h +++ b/src/include/mempool.h @@ -376,11 +376,12 @@ public: \ template > \ using map = std::map>>; \ + pool_allocator>>; \ \ template > \ using multimap = std::multimap>>; \ + pool_allocator>>; \ \ template > \ using set = std::set>; \ @@ -395,7 +396,7 @@ public: typename h=std::hash, \ typename eq = std::equal_to> \ using unordered_map = \ - std::unordered_map>>; \ + std::unordered_map>>;\ \ inline size_t allocated_bytes() { \ return mempool::get_pool(id).allocated_bytes(); \