Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include/mempool.h: fix Clangs complaint about types #13523

Merged
merged 1 commit into from Feb 28, 2017

Commits on Feb 19, 2017

  1. 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>
    wjwithagen committed Feb 19, 2017
    Copy the full SHA
    c4b100c View commit details
    Browse the repository at this point in the history