tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
source_location Struct Reference

A class representing information about the source code, such as file names, line numbers, and function names. More...

#include <source_location.hpp>

Public Member Functions

constexpr source_location () noexcept=default
 
constexpr auto column () const noexcept -> etl::uint_least32_t
 
constexpr auto file_name () const noexcept -> char const *
 
constexpr auto function_name () const noexcept -> char const *
 
constexpr auto line () const noexcept -> etl::uint_least32_t
 

Static Public Member Functions

static consteval auto current (uint_least32_t const line=TETL_BUILTIN_LINE(), uint_least32_t const column=TETL_BUILTIN_COLUMN(), char const *const file=TETL_BUILTIN_FILE(), char const *const function=TETL_BUILTIN_FUNCTION()) noexcept -> source_location
 

Detailed Description

A class representing information about the source code, such as file names, line numbers, and function names.

// SPDX-License-Identifier: BSL-1.0
// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
#if defined(TETL_ENABLE_CXX_MODULES)
import etl;
#else
#endif
#include <stdio.h>
-> void
{
::printf( //
"file: %s(%u:%u) `%s`: %s\n", //
location.file_name(), //
static_cast<unsigned>(location.line()), //
static_cast<unsigned>(location.column()), //
location.function_name(), //
message.data() //
);
}
template <typename T>
static auto fun(T x) -> void
{
log(x);
}
auto main(int /*argc*/, char const** /*argv*/) -> int
{
log("Hello world!");
fun("Hello C++23!");
return 0;
}
constexpr auto log(float v) noexcept -> float
Definition log.hpp:45
The class template bitset represents a fixed-size sequence of Bits bits. Bitsets can be manipulated b...
Definition bitset.hpp:23
A class representing information about the source code, such as file names, line numbers,...
Definition source_location.hpp:20
static consteval auto current(uint_least32_t const line=TETL_BUILTIN_LINE(), uint_least32_t const column=TETL_BUILTIN_COLUMN(), char const *const file=TETL_BUILTIN_FILE(), char const *const function=TETL_BUILTIN_FUNCTION()) noexcept -> source_location
Definition source_location.hpp:21
Examples
source_location.cpp.

Constructor & Destructor Documentation

◆ source_location()

constexpr source_location ( )
constexprdefaultnoexcept

Member Function Documentation

◆ column()

constexpr auto column ( ) const -> etl::uint_least32_t
inlineconstexprnoexcept

◆ current()

◆ file_name()

constexpr auto file_name ( ) const -> char const*
inlineconstexprnoexcept

◆ function_name()

constexpr auto function_name ( ) const -> char const*
inlineconstexprnoexcept

◆ line()

constexpr auto line ( ) const -> etl::uint_least32_t
inlineconstexprnoexcept

The documentation for this struct was generated from the following file: