MCPcopy Create free account
hub / github.com/apache/brpc / elim_push

Method elim_push

src/butil/containers/bounded_queue.h:111–119  ·  view source on GitHub ↗

Push |item| into bottom side of this queue. If the queue is full, pop topmost item first.

Source from the content-addressed store, hash-verified

109 // Push |item| into bottom side of this queue. If the queue is full,
110 // pop topmost item first.
111 void elim_push(const T& item) {
112 if (_count < _cap) {
113 new ((T*)_items + _mod(_start + _count, _cap)) T(item);
114 ++_count;
115 } else {
116 ((T*)_items)[_start] = item;
117 _start = _mod(_start + 1, _cap);
118 }
119 }
120
121 // Push a default-constructed item into bottom side of this queue
122 // Returns address of the item inside this queue

Callers 3

AddMethod · 0.80
UpdateMethod · 0.80
take_sampleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected