STL dequeの方法cbegin(7)

3555 ワード

原文の住所:http://www.cplusplus.com/reference/deque/deque/cbegin/
public member function
<deque>
std::deque:cbegin
const_iterator cbegin() const noexcept;
Return const_iterator to begining
Returns a constiterator pointing to the first element in the container.
アンコールを返しますiteratorは容器の最初の元素を指します.
A constiterator is an iteratothat points to const content.This iterator can be increasure and decrease ed(unless it is itself also const)、just like the iterator returned by deque:begin,but it cannot be used to modify the contensts it points to,even if the deque object is not itself const.
constiteratorは、インクリメントおよび減少することができますが、要素を変更するために使用することはできません.
If the container is empty,the returned iterator value share not be dereferenced.
例:
#include <iostream>
#include <deque>
#include <vector>
using namespace std;
int main()
{
	deque<int> di{1,2,3,4,5};
	for(int i:di)
		cout<<i<<" ";
	cout<<endl;
	cout<<"di.cbegin()="<<*di.cbegin()<<endl;
	
	deque<double> dd;
	cout<<"dd.cbegin()="<<*dd.cbegin()<<endl;
	


}
はスクリーンショットを実行します.
STL deque的方法cbegin(7)_第1张图片
パラメータ
none
Return Value
A constiterator to the beginning of the sequence.
アンコールを返しますiteratorはシーケンスの先頭を指します.
メンバータイプ constiterator is a ラドm access iterator type that points to a const element.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 
// deque::cbegin/cend #include <iostream> #include <deque> int main () { std::deque<int> mydeque = {10,20,30,40,50}; std::cout << "mydeque contains:"; for (auto it = mydeque.cbegin(); it != mydeque.cend(); ++it) std::cout << ' ' << *it; std::cout << '
'; return 0; }
Edit&Run
Output:
mydeque contains: 10 20 30 40 50 
Coplexity
コンサート
Iterator validity
No changes.
Data races
The container is accessed.No contained elemens are accessed by the call,but the iterator returned can be used to access them.Concerently accessing or modifying different elemens safe.
Exception safety
No-throw garantee: this member function never throws exceptions.
The copy construction or assignment of the returned iterator is also garanted to never throw.
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
//翻訳のよくないところをご指導ください.下のメッセージを残したり、左上のメールアドレスをクリックしてメールしてください.私の間違いと不足を指摘してください.修正して、もっと良いのを皆さんに共有できます.ありがとうございます.
//今後の翻訳は簡潔を主として、主な意味だけを翻訳します.多少の重複率が高いものももう翻訳しなくなります.
転載は出典を明記してください.http://blog.csdn.net/qq844352155 author:天下無双
メール:[email protected]
2014-9-1
GDUTで
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————