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

Go to the source code of this file.

Classes

struct  enable_if< predicate, ReturnType >
 
struct  enable_if< true, ReturnType >
 

Typedefs

template<bool predicate, typename ReturnType = void>
using enable_if_t = typename enable_if< predicate, ReturnType >::type
 
template<typename Type >
using enable_if_int_t = enable_if_t< std::is_same_v< Type, int >, Type >
 
template<typename Type >
using enable_if_double_t = enable_if_t< std::is_same_v< Type, double >, Type >
 

Functions

template<typename Type >
enable_if_int_t< Type > remainder (Type n, Type d)
 
template<typename Type >
enable_if_double_t< Type > remainder (Type n, Type d)
 
void test_remainder ()
 
int main ()
 

Variables

tpf::sstream stream
 
auto endl = tpf::endl
 

Typedef Documentation

◆ enable_if_double_t

template<typename Type >
using enable_if_double_t = enable_if_t<std::is_same_v<Type, double>, Type>

Definition at line 29 of file 12_sfinae.cpp.

◆ enable_if_int_t

template<typename Type >
using enable_if_int_t = enable_if_t<std::is_same_v<Type, int>, Type>

Definition at line 26 of file 12_sfinae.cpp.

◆ enable_if_t

template<bool predicate, typename ReturnType = void>
using enable_if_t = typename enable_if<predicate, ReturnType>::type

Definition at line 23 of file 12_sfinae.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 62 of file 12_sfinae.cpp.

Here is the call graph for this function:

◆ remainder() [1/2]

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

Definition at line 34 of file 12_sfinae.cpp.

Here is the caller graph for this function:

◆ remainder() [2/2]

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

Definition at line 42 of file 12_sfinae.cpp.

◆ test_remainder()

void test_remainder ( )

Definition at line 49 of file 12_sfinae.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ endl

auto endl = tpf::endl

Definition at line 4 of file 12_sfinae.cpp.

◆ stream

tpf::sstream stream

Definition at line 3 of file 12_sfinae.cpp.