STL---List

1 篇文章 0 订阅

Sequence Containers:
List:—-double-linked lists
List are sequence containers that allow constant time insert and eraser operations anywhere within the sequence, and iteration in both directions.
Implemented as: Doubly-linked lists,so doesn’t support [ ] (direct access )

They are very similar to forward_list: The main difference being that forward_list objects are single-linked lists, and thus they can only be iterated forwards, in exchange for being somewhat smaller and more efficient.

Compared to array and vector and deque, lists generally better inserting,extracting and moving elements in any position. Algorithms that make intensive use of these, like sorting algorithms.

Function:
1. operator=
Assigns new contents to the container, replacing its current contents, and modifying its size accordingly.

  1. Iterators:
    begin ,end, rbegin,rend,cbegin,cend,crbegin,crend;

  2. Capacity:
    empty,size,max_size(return the max num of elements that the list container can holder)
    eg: if (i<mylist.max_size()) mylist.resize(i);

  3. Element access:
    front,back

  4. Modifiers:
    Assign( ) like operator “=”
    emplace_front( args ) : Inserts a new element at the beginning of the list, right before its current first element. This new element is constructed in place using args as the arguments for its construction.
    A similar member function exists, push_front, which either copies or moves an existing object into the container.
    emplace_back(args)
    push_front( ); push_back ( );
    pop_front( ); pop_back( );
    Insert( ) : inserting new elements before the element at the specified position.
    eg:

mylist.insert (it,10);  
mylist.insert (it,2,20);  
mylist.insert (it,myvector.begin(),myvector.end());

erase(args ):
iterator erase (iterator position);—-single element
iterator erase (iterator first, iterator last);—-range of elements
PS: eraser( ) is wrong

Swap( list &x ):Exchanges the content of the container by the content of x.

std::list<int>().swap(first); to clear all first elements 

Resize( ):
Resizes the container so that it contains n elements. If n is smaller than the current container size, the content is reduced to its first n elements, removing those beyond (and destroying them).

clear( ):
Removes all elements from the list container (which are destroyed), and leaving the container with a size of 0.

Advance (iterator,n)
Advances the iterator it by n element positions.
If it is a random-access iterator, the function uses just once operator+ or operator-. Otherwise, the function uses repeatedly the increase or decrease operator (operator++ or operator–) until n elements have been advanced.

Splice( )
Splice(iterator position,list &x)
Splice(iterator position,list &x,iterator i)
Splice(iterator position,list &x,iterator first, ,iterator last)
Transfers elements from x into the container, inserting them at position.

remove( const value_type& val);
Removes from the container all the elements that compare equal to val
compared with member function list::erase, which erases elements by their position (using an iterator), this function (list::remove) removes elements by their value.

remove_if( )
Remove elements fulfilling condition

unique( )
Remove duplicate values

merge( )
Merge sorted lists

sort( )—-stable,approximately NlogN where N is the container size.Sorts the elements in the list, altering their position within the container.
Reverse( )
Reverse the order of elements

STL分解-LSTM是一种深度学习模型,它结合了STL(Seasonal and Trend decomposition using Loess)分解和LSTM(Long Short-Term Memory)模型的特点。在这种方法中,首先使用STL分解将时间序列数据分解为趋势、季节性和残差三个部分。然后,将分解后的趋势和季节性数据作为LSTM模型的输入,用于预测未来的时间序列值。通过结合STL分解和LSTM模型,STL分解-LSTM模型可以更好地捕捉时间序列数据的长期依赖和季节性变化,从而提高预测准确性。引用中的图7展示了ISTL-LSTM模型和STL-LSTM模型的预测结果的比较,而引用中的图6展示了不同深度学习模型(包括ISTL-LSTM,STL-LSTM,LSTM和GRU)在不同超参数设置下的预测效果比较。另外,引用给出了STL分解-LSTM模型的超参数设置,其中包括隐藏层数、神经元数量、训练迭代次数、batch size、dropout率、激活函数、损失函数和优化器的选择。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [《一种改进的STL-LSTM模型:用于COVID-19疫情期间每日公交客流预测》](https://blog.csdn.net/zuiyishihefang/article/details/123320971)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值