本文整理汇总了C++中std::forward_list::push_front方法的典型用法代码示例。如果您正苦于以下问题:C++ forward_list::push_front方法的具体用法?C++ forward_list::push_front怎么用?C++ forward_list::push_front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::forward_list
的用法示例。
在下文中一共展示了forward_list::push_front方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_connected_gates
void add_connected_gates(int gate, std::forward_list<int>& gates)
{
for(size_t i = 0; i < channels.size(); ++i) {
if(channels[i][0] == gate)
gates.push_front(channels[i][1]);
if(channels[i][1] == gate)
gates.push_front(channels[i][0]);
}
}
示例2: getList
void AreaCombat::getList(const Position& centerPos, const Position& targetPos, std::forward_list<Tile*>& list) const
{
const MatrixArea* area = getArea(centerPos, targetPos);
if (!area) {
return;
}
uint32_t centerY, centerX;
area->getCenter(centerY, centerX);
Position tmpPos(targetPos.x - centerX, targetPos.y - centerY, targetPos.z);
uint32_t cols = area->getCols();
for (uint32_t y = 0, rows = area->getRows(); y < rows; ++y) {
for (uint32_t x = 0; x < cols; ++x) {
if (area->getValue(y, x) != 0) {
if (g_game.isSightClear(targetPos, tmpPos, true)) {
Tile* tile = g_game.map.getTile(tmpPos);
if (!tile) {
tile = new StaticTile(tmpPos.x, tmpPos.y, tmpPos.z);
g_game.map.setTile(tmpPos, tile);
}
list.push_front(tile);
}
}
tmpPos.x++;
}
tmpPos.x -= cols;
tmpPos.y++;
}
}
示例3: extract
static void extract(const jsonpack::value &v, char* json_ptr, std::forward_list<T> &value)
{
array_t arr = *v._arr;
value.clear();
for(const auto &it : arr)
{
#ifndef _MSC_VER
// Initialize before use
T val = {};
#else
T val;
#endif
if( json_traits<T&>::match_token_type(it) )
{
json_traits<T&>::extract(it, json_ptr, val);
// forward_list not support insert operation
value.push_front(val);
}
else
{
throw type_error( "Forward_list item type mismatch" );
}
}
}
示例4: u
typename boost::disable_if<
typename detail::is_default_constructible<
typename std::forward_list<T, Allocator>::value_type
>,
void
>::type
collection_load_impl(
Archive & ar,
std::forward_list<T, Allocator> &t,
collection_size_type count,
item_version_type item_version
){
t.clear();
boost::serialization::detail::stack_construct<Archive, T> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
t.push_front(u.reference());
typename std::forward_list<T, Allocator>::iterator last;
last = t.begin();
ar.reset_object_address(&(*t.begin()) , & u.reference());
while(--count > 0){
detail::stack_construct<Archive, T> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
last = t.insert_after(last, u.reference());
ar.reset_object_address(&(*last) , & u.reference());
}
}
示例5:
StackTrieNode *createTrieNode(uint32_t ThreadId, int32_t FuncId,
StackTrieNode *Parent) {
NodeStore.push_front(StackTrieNode{FuncId, Parent, {}, {{}, {}}});
auto I = NodeStore.begin();
auto *Node = &*I;
if (!Parent)
Roots[ThreadId].push_back(Node);
return Node;
}
示例6: add
void add(string term){
if(terms.find(term) == terms.end()){
node *n = new node;
n->t=term;
n->i=1;
termStack.push_front(*n);
terms[term]=&termStack.front();
}
else{
terms[term]->i++;
}
}
示例7: rReverse
void rReverse(std::forward_list<int> &l){
if(!l.empty()){
a = l.front();
l.pop_front(); //Remove all elements until empty
rReverse(l);
}else{
l.push_front(a); //Insert elements from the function stack
}
}
示例8:
// TraialPool::get_traials() specialization for STL std::forward_list<>
template<> void
TraialPool::get_traials(std::forward_list< Reference<Traial> >& flist,
unsigned numTraials)
{
assert(0u < numTraials);
numTraials++; // loop guard condition requires this increment
retrieve_traials:
while (!available_traials_.empty() && 0u < --numTraials) {
flist.push_front(available_traials_.front());
available_traials_.pop_front();
}
if (0u < numTraials) {
ensure_resources(std::max<unsigned>(numTraials++, sizeChunkIncrement));
goto retrieve_traials;
}
}
示例9: getCombatArea
void Combat::getCombatArea(const Position& centerPos, const Position& targetPos, const AreaCombat* area, std::forward_list<Tile*>& list)
{
if (targetPos.z >= MAP_MAX_LAYERS) {
return;
}
if (area) {
area->getList(centerPos, targetPos, list);
} else {
Tile* tile = g_game.map.getTile(targetPos);
if (!tile) {
tile = new StaticTile(targetPos.x, targetPos.y, targetPos.z);
g_game.map.setTile(targetPos, tile);
}
list.push_front(tile);
}
}
示例10: rReturn
//Using recursion
int rReturn(std::forward_list<int> l, int n){
static int i = 0;
if(i == n)
return l.front();
if(!l.empty())
{
int a = l.front();
l.pop_front();
rReturn(l, n);
l.push_front(a);
i++;
}
}
示例11: AddDestruct
/**
* Add a #Window to the "destruct" list: the object will be deleted
* by calling the class's Clear() method. This means that the caller
* doesn't have to keep track of the specified Window, because this
* SubForm is now responsible for freeing memory.
* Clear() must be called before deleting this form to delete windows
* in the list.
*/
void AddDestruct(Window *window) {
destruct_windows.push_front(window);
}
示例12: boardToList
void Board::boardToList(int ri, int ci, int rn, int cn, std::forward_list<Board*> & l)
{
Board*b = new Board(this);
exch(b->blocks, ri, ci, rn, cn);
l.push_front(b);
}
示例13: connect
inline void connect(const slot_t& f) // O(1)
{
slots.push_front(f);
}
示例14:
static void
fbsd_add_vfork_done (ptid_t pid)
{
fbsd_pending_vfork_done.push_front (pid);
}
示例15: good_push_front_forward_list1
void good_push_front_forward_list1(std::forward_list<int> &FL, int n) {
auto i0 = FL.cbegin(), i1 = FL.cend();
FL.push_front(n);
*i0; // no-warning
}