[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/container/vector/front [Back]  [Original]

std::vector::front cppreference.com
cppreference.com

std::vector::front

cppreference.com
<tbody> </tbody> <tbody class="t-dcl-rev "> </tbody><tbody> </tbody> <tbody class="t-dcl-rev "> </tbody><tbody> </tbody>
reference front();
( C++20)
constexpr reference front();
( C++20)
const_reference front() const;
( C++20)
constexpr const_reference front() const;
( C++20)

.

front .

()

c, c.front() - *c.begin().

front std::vector<char>:

#include <vector>
#include <iostream>
 
int main()
{
    std::vector<char> letters {'o', 'm', 'g', 'w', 't', 'f'};
 
    if (!letters.empty()) {
        std::cout << "  - '" << letters.front() << "'.\n";
    }  
}

:

  - 'o'.

.


(public -) []

Web Proxy Viewer  |  New URL  |  Original Page