All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
util::is_instance_of< Template, T > Struct Template Reference

Trait describing whether T is a template instance of Template. More...

#include <MetaUtils.h>

Inheritance diagram for util::is_instance_of< Template, T >:
util::details::is_instance_of_impl< Template, std::decay_t< T > >

Detailed Description

template<template< typename...> typename Template, typename T>
struct util::is_instance_of< Template, T >

Trait describing whether T is a template instance of Template.

Template Parameters
Templatetemplate class to be detected
Ttype to be tested

This trait is true if the type T is an instance of template class Template, that is, if T is Template<...>, with the ellipsis represents any template argument. Before being tested, T is stripped of reference and constantness qualifiers, so that for example the answer will be the same for std::vector<int> as for std::vector<int> const, std::vector<int> volatile&, etc.

Bug:
The limitation of this implementation is that only Template types taking only type arguments can be used. For example, attempting to use it with std::array, which contains a non-type argument (of type std::size_t), will cause a compilation error. For example, GCC 7.2 reports:
error: type/value mismatch at argument 1 in template parameter list for ‘template<template<class ...> class Template, class T> constexpr const bool util::is_instance_of_v<Template, T>’
static_assert(util::is_instance_of_v<std::array, std::array<int, 2U>>);

Definition at line 369 of file MetaUtils.h.


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