c++-gtk-utils

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Static Public Attributes | List of all members
Cgu::DoIf::RelatedTest< Base, Obj > Class Template Reference

Class for compile time testing of inheritance relationships. More...

`#include <c++-gtk-utils/do_if.h>`

## Static Public Attributes
static const bool | value

## Detailed Description

### template<class Base, class Obj>
class Cgu::DoIf::RelatedTest< Base, Obj >

Class for compile time testing of inheritance relationships.

See Also
  DoIf::mem_fun DoIf::fun

This class provides a compile time test of whether the Obj class template parameter type is related to the Base class template parameter type by public derivation, or they are of the same type: the 'value' public member will be true if they are, otherwise false. Everything in it comprises a compile time constant so that 'value' can be used as a template parameter for conditional complation, and can also be used with the std::enable_if template.

This class tests convertibility, and constness is not discarded in making the test. Whilst a non-const type passed as the second template parameter will (if the other conditions referred to above are met) be shown as related to a const base type or const same type specified as the first template parameter type, the reverse is not true. This ensures that the DoIf::mem_fun() and DoIf::fun() conditional compilation functions work correctly.

## Member Data Documentation

template<class Base , class Obj >

const bool Cgu::DoIf::RelatedTest< Base, Obj >::value
| static

Initial value:
= TestObjType::value == true
&& TestVoidType::value == false

A compile time constant which indicates whether the Obj class template parameter type is related to the Base class template parameter type by public derivation, or they are of the same type. Because it is a compile time constant it can be used as a template parameter and therefore for conditional compilation.

This constant specifies convertibility, and constness is not discarded in making the test. Whilst a non-const type passed as the second template parameter will (if the other conditions referred to above are met) be shown as related to a const base type or const same type specified as the first template parameter type, the reverse is not true. This ensures that the DoIf::mem_fun() and DoIf::fun() conditional compilation functions work correctly.

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

- do_if.h