|
xapian-core
2.0.0
|
Suitable for "simple" type T. More...
#include <smallvector.h>
Inheritance diagram for Xapian::Vec< T, COW, UNIQUEPTR, typename >:Classes | |
| struct | Vec_to_copy |
Public Types | |
| typedef std::size_t | size_type |
| typedef const T * | const_iterator |
| typedef T * | iterator |
Public Member Functions | |
| Vec () | |
| Vec (const Vec &)=delete | |
| Vec (const Vec_to_copy &o) | |
| void | operator= (const Vec &)=delete |
| void | operator= (const Vec_to_copy &o) |
| template<bool ENABLE = !UNIQUEPTR> | |
| auto | copy () const -> typename std::enable_if_t< ENABLE, Vec_to_copy > |
| Vec (Vec &&o) noexcept | |
| void | operator= (Vec &&o) |
| Vec (size_type n) | |
| ~Vec () | |
| size_type | size () const |
| size_type | capacity () const |
| bool | empty () const |
| void | reserve (size_type n) |
| const_iterator | cbegin () const |
| const_iterator | cend () const |
| const_iterator | begin () const |
| const_iterator | end () const |
| iterator | begin () |
| iterator | end () |
| void | push_back (T elt) |
| void | pop_back () |
| void | clear () |
| void | erase (const_iterator it) |
| void | erase (const_iterator b, const_iterator e) |
| void | insert (const_iterator pos, const T &elt) |
| const T & | operator[] (size_type idx) const |
| T & | operator[] (size_type idx) |
| const T & | front () const |
| const T & | back () const |
| template<bool ENABLE = !UNIQUEPTR> | |
| T | release_at (size_type idx) |
Protected Member Functions | |
| void | do_free () |
| void | do_reserve (size_type n) |
| void | do_cow () |
| void | do_copy_from (const Vec &o) |
| bool | is_external () const noexcept |
| Return true if storage is external to the object. More... | |
Private Attributes | |
| std::size_t | c = 0 |
| union { | |
| T v [INTERNAL_CAPACITY] | |
| struct { | |
| T * b | |
| T * e | |
| } p | |
| } | u |
Static Private Attributes | |
| static constexpr std::size_t | INTERNAL_CAPACITY = 2 * sizeof(T*) / sizeof(T) |
Suitable for "simple" type T.
T needs to be trivially copyable.
If sizeof(T) > 2 * sizeof(T*) this isn't going to work, and it's not very useful when sizeof(T) == 2 * sizeof(T*) as you can only store a single element inline.
Offers optional Copy-On-Write functionality - if COW is true, then copying a Vec with external data only makes a copy of that data if you attempt to modify it. Current COW is only supported for integral types T.
Offers optional unique pointer handling - if UNIQUEPTR is true it acts in a similar way to std::vector<std::unique_ptr<T>>.
Definition at line 62 of file smallvector.h.
| typedef const T* Xapian::Vec< T, COW, UNIQUEPTR, typename >::const_iterator |
Definition at line 85 of file smallvector.h.
| typedef T* Xapian::Vec< T, COW, UNIQUEPTR, typename >::iterator |
Definition at line 87 of file smallvector.h.
| typedef std::size_t Xapian::Vec< T, COW, UNIQUEPTR, typename >::size_type |
Definition at line 83 of file smallvector.h.
|
inline |
Definition at line 89 of file smallvector.h.
|
delete |
|
inline |
Definition at line 98 of file smallvector.h.
References Xapian::Vec< T, COW, UNIQUEPTR, typename >::Vec_to_copy::ref.
|
inlinenoexcept |
Definition at line 116 of file smallvector.h.
|
inlineexplicit |
Definition at line 127 of file smallvector.h.
|
inline |
Definition at line 131 of file smallvector.h.
|
inline |
Definition at line 337 of file smallvector.h.
Referenced by HoneyCompact::merge_docid_keyed(), GlassPositionListTable::pack(), and HoneyPositionTable::pack().
|
inline |
Definition at line 169 of file smallvector.h.
|
inline |
Definition at line 161 of file smallvector.h.
Referenced by Xapian::Internal::Context::shrink().
|
inline |
Definition at line 139 of file smallvector.h.
|
inline |
Definition at line 153 of file smallvector.h.
|
inline |
Definition at line 157 of file smallvector.h.
|
inline |
Definition at line 219 of file smallvector.h.
|
inline |
Definition at line 112 of file smallvector.h.
Referenced by InMemoryPositionList::assign().
|
inlineprotected |
Definition at line 387 of file smallvector.h.
References Xapian::Vec< T, COW, UNIQUEPTR, typename >::c, Xapian::Vec< T, COW, UNIQUEPTR, typename >::is_external(), Xapian::Vec< T, COW, UNIQUEPTR, typename >::p, and Xapian::Vec< T, COW, UNIQUEPTR, typename >::u.
|
inlineprotected |
Definition at line 379 of file smallvector.h.
|
inlineprotected |
Definition at line 351 of file smallvector.h.
|
inlineprotected |
Definition at line 362 of file smallvector.h.
References rare.
|
inline |
Definition at line 143 of file smallvector.h.
Referenced by GlassPositionListTable::pack(), and HoneyPositionTable::pack().
|
inline |
Definition at line 181 of file smallvector.h.
|
inline |
Definition at line 165 of file smallvector.h.
Referenced by Xapian::Internal::Context::shrink().
|
inline |
Definition at line 249 of file smallvector.h.
|
inline |
Definition at line 229 of file smallvector.h.
References p.
Referenced by Xapian::Internal::Context::shrink().
|
inline |
Definition at line 333 of file smallvector.h.
|
inline |
Definition at line 273 of file smallvector.h.
|
inlineprotectednoexcept |
Return true if storage is external to the object.
Definition at line 402 of file smallvector.h.
Referenced by Xapian::Vec< T, COW, UNIQUEPTR, typename >::do_copy_from().
|
delete |
|
inline |
Definition at line 106 of file smallvector.h.
References Xapian::Vec< T, COW, UNIQUEPTR, typename >::Vec_to_copy::ref.
|
inline |
Definition at line 121 of file smallvector.h.
|
inline |
Definition at line 324 of file smallvector.h.
|
inline |
Definition at line 320 of file smallvector.h.
|
inline |
Definition at line 206 of file smallvector.h.
|
inline |
Definition at line 190 of file smallvector.h.
Referenced by HoneyValueManager::add_document(), Xapian::Internal::Context::add_postlist(), DEFINE_TESTCASE(), Matcher::get_local_mset(), HoneyCompact::merge_docid_keyed(), RemoteDatabase::open_position_list(), Inverter::set_positionlist(), and HoneyInverter::set_positionlist().
|
inline |
Definition at line 343 of file smallvector.h.
|
inline |
Definition at line 147 of file smallvector.h.
Referenced by Xapian::Internal::Context::Context(), Inverter::set_positionlist(), and HoneyInverter::set_positionlist().
|
inline |
Definition at line 135 of file smallvector.h.
Referenced by HoneyValueManager::add_document(), ProtoMSet::finalise(), Matcher::get_local_mset(), HoneyCompact::merge_docid_keyed(), GlassPositionListTable::pack(), and HoneyPositionTable::pack().
| T* Xapian::Vec< T, COW, UNIQUEPTR, typename >::b |
Definition at line 71 of file smallvector.h.
|
private |
Definition at line 64 of file smallvector.h.
Referenced by Xapian::Vec< T, COW, UNIQUEPTR, typename >::do_copy_from().
| T* Xapian::Vec< T, COW, UNIQUEPTR, typename >::e |
Definition at line 72 of file smallvector.h.
|
staticconstexprprivate |
Definition at line 66 of file smallvector.h.
| struct { ... } Xapian::Vec< T, COW, UNIQUEPTR, typename >::p |
Referenced by Xapian::Vec< T, COW, UNIQUEPTR, typename >::do_copy_from().
| union { ... } Xapian::Vec< T, COW, UNIQUEPTR, typename >::u |
Referenced by Xapian::Vec< T, COW, UNIQUEPTR, typename >::do_copy_from().
| T Xapian::Vec< T, COW, UNIQUEPTR, typename >::v[INTERNAL_CAPACITY] |
Definition at line 69 of file smallvector.h.