cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
toolbox::logger::is_container< T, typename > Struct Template Reference

检查类型是否为容器的类型特征 / Type trait to check if a type is a container More...

#include <thread_logger.hpp>

Inheritance diagram for toolbox::logger::is_container< T, typename >:

Detailed Description

template<typename T, typename = void>
struct toolbox::logger::is_container< T, typename >

检查类型是否为容器的类型特征 / Type trait to check if a type is a container

此模板检查类型是否满足容器的基本要求 / This template checks if a type meets the basic requirements of a container:

  • 具有value_type类型定义 / Has a value_type typedef
  • 具有iterator类型定义 / Has an iterator typedef
  • 具有begin()和end()方法 / Has begin() and end() methods
Template Parameters
T要检查容器属性的类型 / The type to check for container properties
_SFINAE辅助参数(默认void) / SFINAE helper parameter (default void)
// 检查std::vector是否为容器 / Check if std::vector is a container
static_assert(is_container<std::vector<int>>::value, "vector is a
container");
// 检查int是否为容器 / Check if int is a container
static_assert(!is_container<int>::value, "int is not a container");
检查类型是否为容器的类型特征 / Type trait to check if a type is a container
Definition thread_logger.hpp:59

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