iterative-solver 0.0
molpro::linalg::itsolv::log::ContextBase< CRTP, fixed_args, Args > Struct Template Reference

#include <Logger.h>

Detailed Description

template<typename CRTP, bool fixed_args, typename ... Args>
struct molpro::linalg::itsolv::log::ContextBase< CRTP, fixed_args, Args >

Base class for all context classes, which serve as a compile-time identifiable log contextss.

Public Types

using arg_types_tuple = std::tuple< std::remove_cvref_t< Args >... >
 
template<std::size_t Idx>
using arg_t = decltype(to_arg(std::declval< std::tuple_element_t< Idx, arg_types_tuple > >()))
 

Static Public Member Functions

template<typename T >
static constexpr decltype(auto) to_arg (T &&arg)
 
template<std::size_t Idx, typename ... Ts>
static arg_t< Idx > get_arg (Ts &&...args)
 

Static Public Attributes

static constexpr const char * name
 
static constexpr bool uses_fixed_arguments = fixed_args
 
static constexpr std::size_t num_args = sizeof...(Args)
 

Member Typedef Documentation

◆ arg_t

template<typename CRTP , bool fixed_args, typename ... Args>
template<std::size_t Idx>
using molpro::linalg::itsolv::log::ContextBase< CRTP, fixed_args, Args >::arg_t = decltype(to_arg(std::declval<std::tuple_element_t<Idx, arg_types_tuple> >()))

The type if the Idx-th argument that uses of this log context imply. Only applies if the context actually uses a fixed argument set.

◆ arg_types_tuple

template<typename CRTP , bool fixed_args, typename ... Args>
using molpro::linalg::itsolv::log::ContextBase< CRTP, fixed_args, Args >::arg_types_tuple = std::tuple<std::remove_cvref_t<Args>...>

Member Function Documentation

◆ get_arg()

template<typename CRTP , bool fixed_args, typename ... Args>
template<std::size_t Idx, typename ... Ts>
static arg_t< Idx > molpro::linalg::itsolv::log::ContextBase< CRTP, fixed_args, Args >::get_arg ( Ts &&...  args)
inlinestatic

Extracts the requested argument from the provided argument pack

◆ to_arg()

template<typename CRTP , bool fixed_args, typename ... Args>
template<typename T >
static constexpr decltype(auto) molpro::linalg::itsolv::log::ContextBase< CRTP, fixed_args, Args >::to_arg ( T &&  arg)
inlinestaticconstexpr

Converts the given object to the type it should be handled as in downstream log handlers. For non-ranges that means ensuring the type is const a const reference whereas for ranges, we convert them to a view (as const ranges can't be iterated over in the general case).

Member Data Documentation

◆ name

template<typename CRTP , bool fixed_args, typename ... Args>
constexpr const char* molpro::linalg::itsolv::log::ContextBase< CRTP, fixed_args, Args >::name
staticconstexpr
Initial value:
= []() {
if constexpr (name_tagged<CRTP>) {
return CRTP::name;
}
return typeid(CRTP).name();
}
static constexpr const char * name
Definition: Logger.h:65

The name of this logging context

◆ num_args

template<typename CRTP , bool fixed_args, typename ... Args>
constexpr std::size_t molpro::linalg::itsolv::log::ContextBase< CRTP, fixed_args, Args >::num_args = sizeof...(Args)
staticconstexpr

Number of arguments calls using this log context will use (if using a fixed argument set)

◆ uses_fixed_arguments

template<typename CRTP , bool fixed_args, typename ... Args>
constexpr bool molpro::linalg::itsolv::log::ContextBase< CRTP, fixed_args, Args >::uses_fixed_arguments = fixed_args
staticconstexpr

Whether calls using this log context use a fixed set of arguments