From cppreference.com
constexprstd::uint_least32_tcolumn()constnoexcept;(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)
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<typenameT=std::source_location>inlinevoidpos(constT&location=T::current()){std::cout<<"("<<location.line()<<':'<<location.column()<<") ";}intmain(){// ↓: column #9pos();std::cout<<"Proxima\n";// row #18pos();std::cout<<"Centauri\n";// row #19// ↑: column #11}Possible output:
(18:9) Proxima (19:11) Centauri See also