BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls::ProtocolTest_IsAbstract< T > Struct Template Reference

#include <bsls_protocoltest.h>

Classes

struct  NoType
 

Public Types

enum  { value = sizeof(test<T>(0)) == sizeof(YesType) }
 
typedef char YesType
 

Static Public Member Functions

template<class U >
static NoType test (U(*)[1])
 
template<class U >
static YesType test (...)
 

Detailed Description

template<class T>
struct bsls::ProtocolTest_IsAbstract< T >

This class template is a compile-time meta-function, parameterized with type T, the output of which is value, which will be true if T is abstract and false otherwise. On some platforms, the IsAbstract test makes use of the fact that a type 'an array of objects of an abstract type' (e.g., T[1]) cannot exist. Note that it is only an approximation, because this is also true for an incomplete type. But, this approximation is good enough for the purpose of testing protocol classes. On certain other platforms, the IsAbstract test will make use of the fact that abstract types cannot be returned. This approximation also has issues, noted below, but is also good enough for the purpose of testing protocol classes.

This component-private, meta-function struct template provides a compile-time constant value class member with the value true if the supplied T type is an abstract class type, and provides a value class member with the value false otherwise. This meta-function matches the behavior std::is_abstract would have if it were available on C++03 platforms.

Member Typedef Documentation

◆ YesType

template<class T >
typedef char bsls::ProtocolTest_IsAbstract< T >::YesType

Member Enumeration Documentation

◆ anonymous enum

template<class T >
anonymous enum
Enumerator
value 

Member Function Documentation

◆ test() [1/2]

template<class T >
template<class U >
static YesType bsls::ProtocolTest_IsAbstract< T >::test (   ...)
static

◆ test() [2/2]

template<class T >
template<class U >
static NoType bsls::ProtocolTest_IsAbstract< T >::test ( U(*)  [1])
static

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