tt::is_a< U, T > Struct Template Reference

Check if type T is a template specialization of U More...

#include <IsA.hpp>

Detailed Description

template<template< typename... > class U, typename T>
struct tt::is_a< U, T >

Check if type T is a template specialization of U

Requires: U is a class template

Effects: If T is a template specialization of U, then inherits from std::true_type, otherwise inherits from std::false_type

Usage

For any type T and class template U

using result = tt::is_a<U, T>;

Returns: std::bool_constant

Semantics: If the type T is a template specialization of the type U, then

typename result::type = std::true_type;

otherwise

typename result::type = std::false_type;

Example

static_assert(tt::is_a<std::vector, std::vector<double>>::value,
"Failed testing type trait is_a<vector>");
"Failed testing type trait is_a<vector>");
"Failed testing type trait is_a<vector>");
static_assert(tt::is_a<std::deque, std::deque<double>>::value,
"Failed testing type trait is_a<deque>");
"Failed testing type trait is_a<deque>");
static_assert(tt::is_a<std::deque, std::deque<D>>::value,
"Failed testing type trait is_a<deque>");
"Failed testing type trait is_a<forward_list>");
"Failed testing type trait is_a<forward_list>");
"Failed testing type trait is_a<forward_list>");
static_assert(tt::is_a<std::list, std::list<double>>::value,
"Failed testing type trait is_a<list>");
"Failed testing type trait is_a<list>");
static_assert(tt::is_a<std::list, std::list<D>>::value,
"Failed testing type trait is_a<list>");
"Failed testing type trait is_a<map>");
"Failed testing type trait is_a<map>");
"Failed testing type trait is_a<map>");
"Failed testing type trait is_a<unordered_map>");
"Failed testing type trait is_a<unordered_map>");
static_assert(
"Failed testing type trait is_a<unordered_map>");
static_assert(tt::is_a<std::set, std::set<double>>::value,
"Failed testing type trait is_a<set>");
"Failed testing type trait is_a<set>");
static_assert(tt::is_a<std::set, std::set<D>>::value,
"Failed testing type trait is_a<set>");
"Failed testing type trait is_a<unordered_set>");
"Failed testing type trait is_a<unordered_set>");
"Failed testing type trait is_a<unordered_set>");
"Failed testing type trait is_a<multiset>");
"Failed testing type trait is_a<multiset>");
static_assert(tt::is_a<std::multiset, std::multiset<D>>::value,
"Failed testing type trait is_a<multiset>");
static_assert(
"Failed testing type trait is_a<unordered_multiset>");
"Failed testing type trait is_a<unordered_multiset>");
static_assert(
"Failed testing type trait is_a<unordered_multiset>");
static_assert(
"Failed testing type trait is_a<multimap>");
"Failed testing type trait is_a<multimap>");
"Failed testing type trait is_a<multimap>");
"Failed testing type trait is_a<unordered_multimap>");
"Failed testing type trait is_a<unordered_multimap>");
"Failed testing type trait is_a<unordered_multimap>");
"Failed testing type trait is_a<priority_queue>");
"Failed testing type trait is_a<priority_queue>");
"Failed testing type trait is_a<priority_queue>");
static_assert(tt::is_a<std::queue, std::queue<double>>::value,
"Failed testing type trait is_a<queue>");
"Failed testing type trait is_a<queue>");
static_assert(tt::is_a<std::queue, std::queue<D>>::value,
"Failed testing type trait is_a<queue>");
static_assert(tt::is_a<std::stack, std::stack<double>>::value,
"Failed testing type trait is_a<stack>");
"Failed testing type trait is_a<stack>");
static_assert(tt::is_a<std::stack, std::stack<D>>::value,
"Failed testing type trait is_a<stack>");
"Failed testing type trait is_a<unique_ptr>");
"Failed testing type trait is_a<unique_ptr>");
"Failed testing type trait is_a<unique_ptr>");
"Failed testing type trait is_a<unique_ptr>");
"Failed testing type trait is_a<shared_ptr>");
"Failed testing type trait is_a<shared_ptr>");
"Failed testing type trait is_a<shared_ptr>");
"Failed testing type trait is_a<shared_ptr>");
"Failed testing type trait is_a<weak_ptr>");
static_assert(tt::is_a<std::weak_ptr, std::weak_ptr<C>>::value,
"Failed testing type trait is_a<weak_ptr>");
static_assert(not tt::is_a<std::weak_ptr, std::unique_ptr<double>>::value,
"Failed testing type trait is_a<weak_ptr>");
"Failed testing type trait is_a<weak_ptr>");
"Failed testing type trait is_a");
static_assert(tt::is_a<std::vector, std::vector<A>>::value,
"Failed testing type trait is_a");
static_assert(tt::is_a<std::future, std::future<double>>::value,
"Failed testing type trait is_a<future>");
"Failed testing type trait is_a<future>");
static_assert(not tt::is_a<std::future, std::shared_future<double>>::value,
"Failed testing type trait is_a<future>");
"Failed testing type trait is_a<shared_future>");
"Failed testing type trait is_a<shared_future>");
static_assert(not tt::is_a<std::shared_future, std::future<double>>::value,
"Failed testing type trait is_a<shared_future>");
See also
is_std_array
Template Parameters
Ttype to check
Uthe type that T might be a template specialization of

The documentation for this struct was generated from the following file:
tt::is_a_t
typename is_a< U, Args... >::type is_a_t
Definition: IsA.hpp:54
std::shared_future
tt::is_a
Check if type T is a template specialization of U
Definition: IsA.hpp:41
std::true_type
std::shared_ptr
std::list
std::unordered_set
std::vector
std::stack
tt::is_a_v
constexpr bool is_a_v
Definition: IsA.hpp:50
std::tuple
std::queue
std::unordered_multimap
std::future
std::multiset
std::forward_list
std::deque
std::map
std::priority_queue
std::weak_ptr
std::unordered_multiset
std::multimap
std::unique_ptr
std::unordered_map
std::set