本文整理汇总了C++中std::list::emplace_front方法的典型用法代码示例。如果您正苦于以下问题:C++ list::emplace_front方法的具体用法?C++ list::emplace_front怎么用?C++ list::emplace_front使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::list
的用法示例。
在下文中一共展示了list::emplace_front方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emplace_front
void emplace_front(Args&&... args) {
const bool need_reinit = (min_ == data_.cend());
data_.emplace_front(std::forward<Args>(args)...);
if (need_reinit || data_.front() < *min_) {
min_ = pointer_to_first();
}
}
示例2: labelNeighbours
static void labelNeighbours(const cv::Mat &image, const int currentLabel,
Eigen::RowMatrixXi &labeledImage,
std::list<std::pair<int, int>> &toLabel) {
if (toLabel.empty())
return;
int yOffset, xOffset;
std::tie(yOffset, xOffset) = toLabel.front();
toLabel.pop_front();
for (int j = -1; j <= 1; ++j) {
for (int i = -1; i <= 1; ++i) {
if (j + yOffset < 0 || j + yOffset >= labeledImage.rows())
continue;
if (i + xOffset < 0 || i + xOffset >= labeledImage.cols())
continue;
if (image.at<uchar>(j + yOffset, i + xOffset) != 255 &&
labeledImage(j + yOffset, i + xOffset) == 0) {
labeledImage(j + yOffset, i + xOffset) = currentLabel;
toLabel.emplace_front(j + yOffset, i + xOffset);
}
}
}
labelNeighbours(image, currentLabel, labeledImage, toLabel);
}
示例3: moveLeft
void moveLeft()
{
if(current != data.begin())
--current;
else
{
data.emplace_front();
current = data.begin();
}
}
示例4: move
// ----------------------------------------------------------------------
// widgets may only be created through this factory function
shared_ptr<ofxWidget> ofxWidget::make(const ofRectangle& rect_) {
// register for mouse events
// this happens only when the first widget gets initialised.
static auto onlyResponder = make_shared<WidgetEventResponder>();
auto widget = shared_ptr<ofxWidget>(new ofxWidget());
widget->mRect = rect_;
widget->mThis = widget; // widget keeps weak store to self - will this make it leak?
// it should not, since we're creating the widget using new(), and not make_shared
sAllWidgets.emplace_front(widget); // store a weak pointer to the new object in our list
ofxWidget::bVisibleListDirty = true;
return std::move(widget);
}
示例5: append
void append(K const& key, VV&& value) {
std::unique_lock<std::mutex> lock(mutex);
if (map.find(key) != map.end()) {
map[key]->second = std::forward<VV>(value);
lst.splice(lst.begin(), lst, map[key]);
} else {
lst.emplace_front(key, std::forward<VV>(value));
}
map[key] = lst.begin();
if (lst.size() > max_size) {
map.erase(lst.back().first);
lst.pop_back();
}
}
示例6: good_emplace_front_list1
void good_emplace_front_list1(std::list<int> &L, int n) {
auto i0 = L.cbegin(), i1 = L.cend();
L.emplace_front(n);
*i0; // no-warning
--i1; // no-warning
}
示例7:
template<class T, class... Ts>void init_impl(T arg, Ts... args)
{
init_impl(args...);
sentence.emplace_front(arg);
}