Blaze  3.6
blaze::HaveSameSize< T1, T2 > Class Template Reference

Compile time size check.This class offers the possibility to test the size of two types at compile time. If an object of type T1 has the same size as an object of type T2, the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType. More...

#include <HaveSameSize.h>

Inherits blaze::IntegralConstant< T, N >.

Detailed Description

template<typename T1, typename T2>
class blaze::HaveSameSize< T1, T2 >

Compile time size check.

This class offers the possibility to test the size of two types at compile time. If an object of type T1 has the same size as an object of type T2, the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.

One example for the application of this type trait is a compile time check if the compiler supports the 'Empty Derived class Optimization (EDO)':

// Definition of the base class A
struct A {
int i_;
};
// Definition of the derived class B
struct B : public A {};
// Testing whether or not an object of type B has the same size as the
// base class A and whether the compiler supports EDO

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