cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
toolbox::logger Namespace Reference

Classes

struct  has_ostream_method
 检查类型是否具有ostream方法的类型特征 / Type trait to check if a type has an ostream method More...
 
struct  has_stream_operator
 检查类型是否具有流插入运算符(<<)的类型特征 / Type trait to check if a type has stream insertion operator (<<) More...
 
struct  is_container
 检查类型是否为容器的类型特征 / Type trait to check if a type is a container More...
 
struct  is_container< T, std::void_t< T::value_type, T::iterator, decltype(std::declval< T >().begin()), decltype(std::declval< T >().end())> >
 
class  thread_logger_t
 具有多个日志级别和格式的线程安全日志类 / Thread-safe logging class with multiple logging levels and formats More...
 

Variables

template<typename T >
constexpr bool is_container_v = is_container<T>::value
 is_container特征的辅助变量模板 / Helper variable template for is_container trait
 
template<typename T >
constexpr bool has_stream_operator_v = has_stream_operator<T>::value
 has_stream_operator特征的辅助变量模板 / Helper variable template for has_stream_operator trait
 
template<typename T >
constexpr bool has_ostream_method_v = has_ostream_method<T>::value
 has_ostream_method特征的辅助变量模板 / Helper variable template for has_ostream_method trait
 

Variable Documentation

◆ has_ostream_method_v

template<typename T >
constexpr bool toolbox::logger::has_ostream_method_v = has_ostream_method<T>::value
inlineconstexpr

has_ostream_method特征的辅助变量模板 / Helper variable template for has_ostream_method trait

提供了一种更方便的方式来访问has_ostream_method特征值 / This provides a more convenient way to access the has_ostream_method trait value

Template Parameters
T要检查ostream方法的类型 / The type to check for ostream method
struct MyType {};
constexpr bool has_ostream = has_ostream_method_v<MyType>;

◆ has_stream_operator_v

template<typename T >
constexpr bool toolbox::logger::has_stream_operator_v = has_stream_operator<T>::value
inlineconstexpr

has_stream_operator特征的辅助变量模板 / Helper variable template for has_stream_operator trait

提供了一种更方便的方式来访问has_stream_operator特征值 / This provides a more convenient way to access the has_stream_operator trait value

Template Parameters
T要检查流插入能力的类型 / The type to check for stream insertion capability
// 检查std::string是否具有流运算符 / Check if std::string has stream operator
constexpr bool can_stream_string = has_stream_operator_v<std::string>;

◆ is_container_v

template<typename T >
constexpr bool toolbox::logger::is_container_v = is_container<T>::value
inlineconstexpr

is_container特征的辅助变量模板 / Helper variable template for is_container trait

提供了一种更方便的方式来访问is_container特征值 / This provides a more convenient way to access the is_container trait value

Template Parameters
T要检查容器属性的类型 / The type to check for container properties
// 检查std::map是否为容器 / Check if std::map is a container
constexpr bool is_map_container = is_container_v<std::map<int, int>>;