std::source...ion::column(3)
β¨ NAME β¨
Okay bestie, this is the manual page for std::source_location::column β and the manual name up top is C++ Standard Libary, folded in here like a little name tag so we donβt copy that header line. π
The NAME line is literally std::source_location::column - std::source_location::column, and honestly? No notes. Iconic. π
π¦ Synopsis π¦
constexpr std::uint_least32_t column() const noexcept; (since C++20)
Returns an implementation-defined value representing some offset from the start of the line represented by this object (i.e., the column number). Column numbers are presumed to be 1-indexed. β
πΌ Parameters πΌ
(none)β not a single parameter, periodt. π
π Return value π
An implementation-defined value representing some offset from the start of the line represented by this object (i.e., the column number).
An implementation is encouraged to use 0 when the column number is unknown. π
πΈ Example πΈ
// Run this code
#include <iostream>
#include <source_location>
template<typename T = std::source_location>
inline void pos(const T& location = T::current())
{
std::cout
<< "("
<< location.line()
<< ':'
<< location.column()
<< ") ";
}
int main()
{
// β: column #9
pos(); std::cout << "Proxima\n"; // row #18
pos(); std::cout << "Centauri\n"; // row #19
// β: column #11
}
π Possible output: π
(18:9) Proxima
(19:11) Centauri
π₯ See also π₯
lineβ return the line 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)- Filename and line information
Thatβs the whole page, bestie. Source/version: http://cppreference.com; date: 2024.06.10. Now go flex that column number π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms