fix: clang build.
This commit is contained in:
parent
665343490b
commit
66688ebe4a
1 changed files with 11 additions and 10 deletions
|
|
@ -91,7 +91,7 @@ private:
|
||||||
void destroy () {
|
void destroy () {
|
||||||
auto destruct = [&] (size_t start, size_t end) {
|
auto destruct = [&] (size_t start, size_t end) {
|
||||||
for (size_t i = start; i < end; ++i) {
|
for (size_t i = start; i < end; ++i) {
|
||||||
cr::alloc.destruct (&contents_[i]);
|
alloc.destruct (&contents_[i]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -108,7 +108,8 @@ private:
|
||||||
void reset () {
|
void reset () {
|
||||||
contents_ = nullptr;
|
contents_ = nullptr;
|
||||||
capacity_ = 0;
|
capacity_ = 0;
|
||||||
index_ = {};
|
|
||||||
|
clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -134,18 +135,18 @@ public:
|
||||||
template <typename U> void emplaceLast (U &&object) {
|
template <typename U> void emplaceLast (U &&object) {
|
||||||
auto rear = pickRearIndex ();
|
auto rear = pickRearIndex ();
|
||||||
|
|
||||||
cr::alloc.construct (&contents_[index_.second], cr::forward <U> (object));
|
alloc.construct (&contents_[index_.second], cr::forward <U> (object));
|
||||||
index_.second = rear;
|
index_.second = rear;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U> void emplaceFront (U &&object) {
|
template <typename U> void emplaceFront (U &&object) {
|
||||||
index_.first = pickFrontIndex ();
|
index_.first = pickFrontIndex ();
|
||||||
|
|
||||||
cr::alloc.construct (&contents_[index_.first], cr::forward <U> (object));
|
alloc.construct (&contents_[index_.first], cr::forward <U> (object));
|
||||||
}
|
}
|
||||||
|
|
||||||
void discardFront () {
|
void discardFront () {
|
||||||
cr::alloc.destruct (&contents_[index_.first]);
|
alloc.destruct (&contents_[index_.first]);
|
||||||
|
|
||||||
if (index_.first == capacity_ - 1) {
|
if (index_.first == capacity_ - 1) {
|
||||||
index_.first = 0;
|
index_.first = 0;
|
||||||
|
|
@ -162,21 +163,21 @@ public:
|
||||||
else {
|
else {
|
||||||
index_.second--;
|
index_.second--;
|
||||||
}
|
}
|
||||||
cr::alloc.destruct (&contents_[index_.second]);
|
alloc.destruct (&contents_[index_.second]);
|
||||||
}
|
}
|
||||||
|
|
||||||
T popFront () {
|
T popFront () {
|
||||||
auto first (front ());
|
auto object (front ());
|
||||||
discardFront ();
|
discardFront ();
|
||||||
|
|
||||||
return first;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
T popLast () {
|
T popLast () {
|
||||||
auto last (last ());
|
auto object (last ());
|
||||||
discardLast ();
|
discardLast ();
|
||||||
|
|
||||||
return last;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue