C++ Library Extensions 2022.12.09
To help learn modern C++ programming
11-type_dispatch.cpp File Reference
#include <tpf_output.hpp>
Include dependency graph for 11-type_dispatch.cpp:

Go to the source code of this file.

Classes

struct  integral_constant< Type, v >
 
struct  is_same< Type_1, Type_2 >
 
struct  is_same< Type, Type >
 

Typedefs

using true_type = integral_constant< bool, true >
 
using false_type = integral_constant< bool, false >
 

Functions

double remainder (double n, double d, double)
 
void test_remainder ()
 
constexpr bool is_same_type (true_type)
 
constexpr bool is_same_type (false_type)
 
void test_is_same ()
 
template<typename RealType >
RealType remainder_impl (RealType n, RealType d, true_type)
 
template<typename IntType >
IntType remainder_impl (IntType n, IntType d, false_type)
 
template<typename Type >
Type remainder (Type n, Type d)
 
void test_type_dispatch ()
 
void test_is_same_v ()
 
int main ()
 

Variables

tpf::sstream stream
 
auto endl = tpf::endl
 
template<typename Type_1 , typename Type_2 >
constexpr auto is_same_v = is_same<Type_1, Type_2>::value()
 

Typedef Documentation

◆ false_type

using false_type = integral_constant<bool, false>

Definition at line 62 of file 11-type_dispatch.cpp.

◆ true_type

using true_type = integral_constant<bool, true>

Definition at line 61 of file 11-type_dispatch.cpp.

Function Documentation

◆ is_same_type() [1/2]

constexpr bool is_same_type ( false_type  )
constexpr

Definition at line 89 of file 11-type_dispatch.cpp.

◆ is_same_type() [2/2]

constexpr bool is_same_type ( true_type  )
constexpr

Definition at line 84 of file 11-type_dispatch.cpp.

Here is the caller graph for this function:

◆ main()

int main ( )

Definition at line 139 of file 11-type_dispatch.cpp.

Here is the call graph for this function:

◆ remainder() [1/2]

double remainder ( double  n,
double  d,
double   
)

Definition at line 26 of file 11-type_dispatch.cpp.

Here is the caller graph for this function:

◆ remainder() [2/2]

template<typename Type >
Type remainder ( Type  n,
Type  d 
)

Definition at line 118 of file 11-type_dispatch.cpp.

Here is the call graph for this function:

◆ remainder_impl() [1/2]

template<typename IntType >
IntType remainder_impl ( IntType  n,
IntType  d,
false_type   
)

Definition at line 112 of file 11-type_dispatch.cpp.

◆ remainder_impl() [2/2]

template<typename RealType >
RealType remainder_impl ( RealType  n,
RealType  d,
true_type   
)

Definition at line 104 of file 11-type_dispatch.cpp.

Here is the caller graph for this function:

◆ test_is_same()

void test_is_same ( )

Definition at line 94 of file 11-type_dispatch.cpp.

Here is the call graph for this function:

◆ test_is_same_v()

void test_is_same_v ( )

Definition at line 132 of file 11-type_dispatch.cpp.

Here is the caller graph for this function:

◆ test_remainder()

void test_remainder ( )

Definition at line 33 of file 11-type_dispatch.cpp.

Here is the call graph for this function:

◆ test_type_dispatch()

void test_type_dispatch ( )

Definition at line 123 of file 11-type_dispatch.cpp.

Here is the call graph for this function:

Variable Documentation

◆ endl

auto endl = tpf::endl

Definition at line 24 of file 11-type_dispatch.cpp.

◆ is_same_v

template<typename Type_1 , typename Type_2 >
constexpr auto is_same_v = is_same<Type_1, Type_2>::value()
constexpr

Definition at line 82 of file 11-type_dispatch.cpp.

◆ stream

tpf::sstream stream

Definition at line 23 of file 11-type_dispatch.cpp.