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<typename allocator_type::value_type, value_type>::value),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins/workspace/ceph-master/src/os/bluestore/bluestore_types.h:204:9: note: in instantiation of template class 'std::__1::map<unsigned long, bluestore_extent_ref_map_t::record_t, std::__1::less<unsigned long>, mempool::pool_allocator<mempool::pool_index_t::mempool_bluestore_meta_other, std::__1::pair<unsigned long, bluestore_extent_ref_map_t::record_t> > >' requested here
map_t ref_map;
This is fixed by make the K in std::pair<k,v> a const.
- Based on the C++ we should use pair<const Key, T> as the value
type of allocator as per C++ standard par. 23.4.4.1, n3337.
namespace std {
template <class Key, class T, class Compare = less<Key>,
class Allocator = allocator<pair<const Key, T> > >
class map {
public:
// types:
typedef Key key_type;
typedef T mapped_type;
typedef pair<const Key, T> value_type;
// ...
};
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>