名前空間
変種
操作

std::list::back

提供: cppreference.com
< cpp‎ | container‎ | list

 
 
 
std::list
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::list
list::~list
list::operator=
list::assign
list::get_allocator
要素アクセスの循環参照を解除するために使用されている
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::front
list::back
イテレータ
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::begin
list::cbegin

(C++11)
list::end
list::cend

(C++11)
list::rbegin
list::crbegin

(C++11)
list::rend
list::crend

(C++11)
容量
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::empty
list::size
list::max_size
修飾子
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::clear
list::insert
list::emplace(C++11)
list::erase
list::push_front
list::emplace_front(C++11)
list::pop_front
list::push_back
list::emplace_back(C++11)
list::pop_back
list::resize
list::swap
操作
Original:
Operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::merge
list::splice
list::remove
list::remove_if
list::reverse
list::unique
list::sort
 
reference back();
const_reference back() const;
コンテナ内の最後の要素への参照を返します.
Original:
Returns reference to the last element in the container.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
空の容器にbackを呼び出すと、定義されていません.
Original:
Calling back on an empty container is undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

(なし)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

最後の要素への参照
Original:
reference to the last element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 複雑

定数
Original:
Constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] ノート

コンテナc、発現return c.back();{ auto tmp = c.end(); --tmp; return *tmp; }に相当します
Original:
For a container c, the expression return c.back(); is equivalent to { auto tmp = c.end(); --tmp; return *tmp; }
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

次のコードは、backの最後の要素を表示するためにstd::list<char>を使用しています
Original:
The following code uses back to display the last element of a std::list<char>:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <list>
#include <iostream>
 
int main()
{
    std::list<char> letters {'o', 'm', 'g', 'w', 't', 'f'};
 
    if (!letters.empty()) {
        std::cout << "The last character is: " << letters.back() << '\n';
    }  
}

Output:

The last character is f

[編集] も参照してください

最初の要素にアクセスします
Original:
access the first element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]