Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251{252Assume(m_size);253std::destroy_at(m_buffer + m_offset);254--m_size;255++m_offset;256if (m_offset == m_capacity) m_offset = 0;257}259/** Remove the last element of the deque. Requires !empty(). */260void pop_back()261{262Assume(m_size);263std::destroy_at(m_buffer + BufferIndex(m_size - 1));264--m_size;265}267/** Get a mutable reference to the first element of the deque. Requires !empty(). */268T& front() noexcept269{270Assume(m_size);271return m_buffer[m_offset];272}274/** Get a const reference to the first element of the deque. Requires !empty(). */275const T& front() const noexcept276{277Assume(m_size);278return m_buffer[m_offset];279}281/** Get a mutable reference to the last element of the deque. Requires !empty(). */282T& back() noexcept283{284Assume(m_size);285return m_buffer[BufferIndex(m_size - 1)];286}288/** Get a const reference to the last element of the deque. Requires !empty(). */289const T& back() const noexcept290{291Assume(m_size);292return m_buffer[BufferIndex(m_size - 1)];293}295/** Get a mutable reference to the element in the deque at the given index. Requires idx < size(). */296T& operator[](size_t idx) noexcept297{298Assume(idx < m_size);299return m_buffer[BufferIndex(idx)];300}302/** Get a const reference to the element in the deque at the given index. Requires idx < size(). */303const T& operator[](size_t idx) const noexcept304{305Assume(idx < m_size);306return m_buffer[BufferIndex(idx)];307}309/** Test whether the contents of this deque is empty. */310bool empty() const noexcept { return m_size == 0; }311/** Get the number of elements in this deque. */312size_t size() const noexcept { return m_size; }313/** Get the capacity of this deque (maximum size it can have without reallocating). */314size_t capacity() const noexcept { return m_capacity; }315};317#endif // BITCOIN_UTIL_VECDEQUE_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.