C++ features by examples
Collaboration diagram for Deduction:

Macros

#define static_assert(a)   static_assert(a, "")
 

Functions

auto implicit_int_return_type ()
 
auto deduced_return_type (int a)
 
template<typename T >
auto & deduced_return_type_template (T &t)
 
void return_type_deduction_demo ()
 

Variables

auto deduced_return_type_lambda
 

Detailed Description

Macro Definition Documentation

◆ static_assert

#define static_assert (   a)    static_assert(a, "")

Definition at line 26 of file 14.cpp.

Function Documentation

◆ deduced_return_type()

auto deduced_return_type ( int  a)

Definition at line 35 of file 14.cpp.

36{
37 return a;
38}
Here is the caller graph for this function:

◆ deduced_return_type_template()

template<typename T >
auto & deduced_return_type_template ( T &  t)

Definition at line 41 of file 14.cpp.

42{
43 return t;
44}

◆ implicit_int_return_type()

auto implicit_int_return_type ( )

Definition at line 29 of file 14.cpp.

30{
31 return 1;
32}
Here is the caller graph for this function:

◆ return_type_deduction_demo()

void return_type_deduction_demo ( )

Definition at line 51 of file 14.cpp.

52{
54 auto x = deduced_return_type(1);
55 int& y = deduced_return_type_lambda(x); // reference to `x`
56 assert(&y == &x);
57 assert(y == 1);
58}
auto deduced_return_type(int a)
Definition: 14.cpp:35
auto implicit_int_return_type()
Definition: 14.cpp:29
auto deduced_return_type_lambda
Definition: 14.cpp:47
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ deduced_return_type_lambda

auto deduced_return_type_lambda
Initial value:
= [](auto& x) -> auto& {
}
auto & deduced_return_type_template(T &t)
Definition: 14.cpp:41

Definition at line 47 of file 14.cpp.