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::source_location::line(3) C++ Standard Libary std::source_location::line(3)

std::source_location::line - std::source_location::line


constexpr std::uint_least32_t line() const noexcept; (since C++20)


Returns the line number represented by this object.


(none)


The line number represented by this object.


An implementation is encouraged to return 0 when the line number is unknown.

// Run this code


#include <iostream>
#include <string_view>
#include <source_location>


inline void cur_line(
const std::string_view message = "",
const std::source_location& location = std::source_location::current())
{
std::cout
<< location.line() // <- the line # of a call site
<< ") "
<< message;
}


int main()
{
cur_line("++\n");
cur_line(); std::cout << "Hello,\n";
cur_line(); std::cout << "C++20!\n";
cur_line("--\n");
}


17) ++
18) Hello,
19) C++20!
20) --


column return the column number represented by this object
(public member function)
file_name return the file name represented by this object
(public member function)
function_name return the name of the function represented by this object, if any
(public member function)
source_line gets the line number that lexically relates the evaluation represented
(C++23) by the stacktrace_entry
(public member function of std::stacktrace_entry)
Filename and line information

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.