C++ question crying

Asked 2 years ago, Updated 2 years ago, 26 views

**Write a pair of print function templates

The first 'print' function template has a C++ templated L-value reference parameter. It prints using cout (or wcout) the parameter value and the phrase "L-Value".

The second 'print' function template has a C++11 templated R-value parameter. It prints using cout (or wcout) the parameter value and the phrase "R-Value".

**Write down the output from running the following code with your pair of function templates.

char broiled = 'X'; 
bool makes = true; 
double trouble = 665.;
print(broiled); 
print(broiled + 2); 
print(std::move(broiled)); 
print(makes + trouble); 
print(2 + 10.6); 
print(L“C++11 is a better C++”);  // may require std::wcout in place of std::cout

I wonder what the template function and the result using it are!! Please help me

c++

2022-09-22 18:28

1 Answers

Template and Function Overloading, R-Value Reference(&&) concepts.

If you understand the above, you will be able to solve the problem.


2022-09-22 18:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.