c++ 문제 질문합니다 ㅠㅠ

조회수 537회

**Write a pair of print function templates

  1. 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".

  2. 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 답변

  • TemplateFunction Overloading, R-Value Reference(&&) 개념을 묻는 문제입니다.

    위 내용을 숙지하시면 충분히 문제를 푸실 수 있습니다 .

    • (•́ ✖ •̀)
      알 수 없는 사용자

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)