The ZX Ecosystem v5.1.0;_GUI_v3.1.0
Loading...
Searching...
No Matches
Classes | Typedefs
Instantiated templates for the LongestType type

Description

LongestType provides the longest type in memory of 2 other given types. The given types must not necessarily be basic types (it also works with classes).

Usage:

typedef LongestType<
                    yourtype0,
                    yourtype1,
                    (sizeof(yourtype0) < sizeof(yourtype1))
                    >::type YourLongestType;
Collaboration diagram for Instantiated templates for the LongestType type:

Classes

class  LongestType< T0, T1, sizet0smallerthansizet1 >
 Select the longest type in memory of two given types T0 and T1. More...
 
class  LongestType< T0, T1, true >
 Case of sizeof(T0) < sizeof(T1) More...
 

Typedefs

using LongestUnsignedType = unsigned long long
 Longest unsigned integral type in the target machine. More...
 

Class Documentation

◆ LongestType

class LongestType
template<typename T0, typename T1, bool sizet0smallerthansizet1>
class LongestType< T0, T1, sizet0smallerthansizet1 >

Select the longest type in memory of two given types T0 and T1.

This is the case of sizeof(T0) >= sizeof(T1)

Definition at line 339 of file CppAddons.h.

Public Types

typedef T0 type
 Longest type of both. More...
 

Member Typedef Documentation

◆ type

template<typename T0 , typename T1 , bool sizet0smallerthansizet1>
typedef T0 LongestType< T0, T1, sizet0smallerthansizet1 >::type

Longest type of both.

Definition at line 343 of file CppAddons.h.

◆ LongestType< T0, T1, true >

class LongestType< T0, T1, true >
template<typename T0, typename T1>
class LongestType< T0, T1, true >

Case of sizeof(T0) < sizeof(T1)

Definition at line 348 of file CppAddons.h.

Public Types

typedef T1 type
 Longest type of both. More...
 

Member Typedef Documentation

◆ type

template<typename T0 , typename T1 >
typedef T1 LongestType< T0, T1, true >::type

Longest type of both.

Definition at line 352 of file CppAddons.h.

Typedef Documentation

◆ LongestUnsignedType

using LongestUnsignedType = unsigned long long

#include <CppAddons.h>

Longest unsigned integral type in the target machine.

This type is useful, for example, to receive an integral argument that can have any length. For indicating a size in memory, use size_t instead: the standard states, in fact, that any object in memory that occupies more than size_t is ill formed.

Definition at line 367 of file CppAddons.h.