FreeBSD Manual Pages
std::experi...ation::line(3) C++ Standard Libary std::experi...ation::line(3) NAME std::experimental::source_location::line - std::experimen- tal::source_location::line Synopsis constexpr std::uint_least32_t line() const noexcept; (library fun- damentals TS v2) Returns the line number represented by this object. Parameters (none) Return value The line number represented by this object. Example // Run this code #include <experimental/source_location> #include <string_view> #include <iostream> using std::experimental::source_location; inline void cur_line( const std::string_view message = "", const source_location& location = source_location::current()) { std::cout << location.line() // <- the call-site line # << ") " << message; } auto main() -> int { cur_line("++" "\n"); cur_line(); std::cout << "Hello," "\n"; cur_line(); std::cout << "C++20!" "\n"; cur_line("--" "\n"); } Output: 18) ++ 19) Hello, 20) C++20! 21) -- See also 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) http://cppreference.com 2022.07.31 std::experi...ation::line(3)
NAME | Synopsis | Parameters | Return value | Example | Output: | See also
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::experimental::source_location::line&sektion=3&manpath=FreeBSD+Ports+15.0>
