]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
include/mempool.h: fix Clangs complaint about types 13523/head
authorWillem Jan Withagen <wjw@digiware.nl>
Sun, 19 Feb 2017 11:57:32 +0000 (12:57 +0100)
committerWillem Jan Withagen <wjw@digiware.nl>
Sun, 19 Feb 2017 19:47:10 +0000 (20:47 +0100)
commitc4b100cdfb1f9c04bd19ed028eade389e874bf97
tree32c0b356d27a692f09ec6d6b6c5ec7f646778559
parentc1c1f2e408b6bb8032dc31660d0e1712311d44da
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>
src/include/mempool.h