GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::span::front(3) C++ Standard Libary std::span::front(3)

std::span::front - std::span::front


constexpr reference front() const;


Returns a reference to the first element in the span.


Calling front on an empty span results in undefined behavior.


(none)


A reference to the first element.


Constant


For a span c, the expression c.front() is equivalent to *c.begin().

// Run this code


#include <span>
#include <iostream>


void print(std::span<const int> const data)
{
for (auto offset{0U}; offset != data.size(); ++offset) {
std::cout << data.subspan(offset).front() << ' ';
}
std::cout << '\n';
}


int main()
{
constexpr int data[] { 0, 1, 2, 3, 4, 5, 6 };
print({data, 4});
}


0 1 2 3


back access the last element
(C++20) (public member function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.