c++ 문제 질문합니다 ㅠㅠ
조회수 537회
**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
템플릿 함수랑 그것을 이용한 결과값 결과 무엇인지 궁금합니다!! 도움 부탁드려요
1 답변
-
Template과 Function Overloading, R-Value Reference(&&) 개념을 묻는 문제입니다.
위 내용을 숙지하시면 충분히 문제를 푸실 수 있습니다 .
-
(•́ ✖ •̀)
알 수 없는 사용자
-
댓글 입력