标准库标头 <source_location> (C++20)

来自cppreference.com
< cpp‎ | header


 
 
标准库头
 

此头文件是工具库的一部分。

表示关于源代码的信息(例如文件名、行号以及函数名)的类
(类)

概要

namespace std {
  struct source_location;
}

std::source_location

namespace std {
  struct source_location {
    // source_location  构造
    static consteval source_location current() noexcept;
    constexpr source_location() noexcept;
 
    // source_location 域访问
    constexpr uint_least32_t line() const noexcept;
    constexpr uint_least32_t column() const noexcept;
    constexpr const char* file_name() const noexcept;
    constexpr const char* function_name() const noexcept;
 
  private:
    uint_least32_t line_;               // 仅为阐释
    uint_least32_t column_;             // 仅为阐释
    const char* file_name_;             // 仅为阐释
    const char* function_name_;         // 仅为阐释
  };
}