mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
flat_set: move comp/data helpers to base
This commit is contained in:
parent
3fb5a3702e
commit
adfb9fe3f9
@ -107,6 +107,12 @@ protected:
|
|||||||
|
|
||||||
flat_base(const Compare &compare, const Allocator &alloc)
|
flat_base(const Compare &compare, const Allocator &alloc)
|
||||||
: storage(storage_type(storage_alloc_type(alloc)), compare) {}
|
: storage(storage_type(storage_alloc_type(alloc)), compare) {}
|
||||||
|
|
||||||
|
storage_type &data() { return std::get<0>(this->storage); }
|
||||||
|
const storage_type &data() const { return std::get<0>(this->storage); }
|
||||||
|
|
||||||
|
Compare &comp() { return std::get<1>(this->storage); }
|
||||||
|
const Compare &comp() const { return std::get<1>(this->storage); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace flat_detail
|
} // namespace flat_detail
|
||||||
@ -125,12 +131,8 @@ class flat_set : flat_detail::flat_base<T, Compare, Allocator>,
|
|||||||
boost::totally_ordered<flat_set<T, Compare, Allocator>> {
|
boost::totally_ordered<flat_set<T, Compare, Allocator>> {
|
||||||
using base_type = flat_detail::flat_base<T, Compare, Allocator>;
|
using base_type = flat_detail::flat_base<T, Compare, Allocator>;
|
||||||
using storage_type = typename base_type::storage_type;
|
using storage_type = typename base_type::storage_type;
|
||||||
|
using base_type::data;
|
||||||
storage_type &data() { return std::get<0>(this->storage); }
|
using base_type::comp;
|
||||||
const storage_type &data() const { return std::get<0>(this->storage); }
|
|
||||||
|
|
||||||
Compare &comp() { return std::get<1>(this->storage); }
|
|
||||||
const Compare &comp() const { return std::get<1>(this->storage); }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Member types.
|
// Member types.
|
||||||
@ -366,12 +368,8 @@ private:
|
|||||||
flat_detail::flat_base<std::pair<Key, T>, Compare, Allocator>;
|
flat_detail::flat_base<std::pair<Key, T>, Compare, Allocator>;
|
||||||
using keyval_storage_type = std::pair<key_type, mapped_type>;
|
using keyval_storage_type = std::pair<key_type, mapped_type>;
|
||||||
using storage_type = typename base_type::storage_type;
|
using storage_type = typename base_type::storage_type;
|
||||||
|
using base_type::data;
|
||||||
storage_type &data() { return std::get<0>(this->storage); }
|
using base_type::comp;
|
||||||
const storage_type &data() const { return std::get<0>(this->storage); }
|
|
||||||
|
|
||||||
Compare &comp() { return std::get<1>(this->storage); }
|
|
||||||
const Compare &comp() const { return std::get<1>(this->storage); }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// More Member types.
|
// More Member types.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user