TTS v3.0.0
The Tiny Test System
 
Loading...
Searching...
No Matches
tts::filter< Pred, Type > Struct Template Reference

Filter a types list by a predicate. More...

Detailed Description

template<template< typename > typename Pred, typename Type>
struct tts::filter< Pred, Type >

Filter a types list by a predicate.

Using an unary predicate template, filter a types list to only keep the types for which the predicate evaluates to true.

Template Parameters
PredPredicate template taking a single type parameter and exposing a static boolean member value
TypeTypes list to filter

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
template<typename T> struct small_type : std::bool_constant<(sizeof(T) < 4)>
{
};
TTS_CASE_TPL("Check types over filtered types list",
tts::filter<small_type, tts::arithmetic_types>::types_list)<typename T>(tts::type<T>)
{
TTS_LESS(sizeof(T), 4UL);
};
auto constexpr typename_
Evaluates to an object containing the name of the type T in readable form.
Definition typename.hpp:126