---
title: "Discussion on \"Way to C++: 5. Forwarding Reference\" | Hashnode"
description: "Discussion on \"Way to C++: 5. Forwarding Reference\". 前言\n假如有一個函數，可以吃下 Int 和 Char 的 l-value 和 r-value 作為參數\nvoid foo(int&& a) {  \n    printf(\"R-Int: %d\\n\", a);  \n}\n\nvoid foo(char&& c) {  \n    printf(\"R-Char: %c\\n\", c);  \n}\n\nvoid foo(const int& a) {  \n    p"
url: "https://hashnode.com/posts/way-to-cpp-5-forwarding-reference/624bb8f64b4dde0dc0bebadb"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Way to C++: 5. Forwarding Reference](https://notes.mukyu.dev/way-to-cpp-5-forwarding-reference?utm_source=hashnode&utm_medium=feed)

前言 假如有一個函數，可以吃下 Int 和 Char 的 l-value 和 r-value 作為參數 void foo(int&& a) { printf("R-Int: %d\\n", a); } void foo(char&& c) { printf("R-Char: %c\\n", c); } void foo(const int& a) { p

Apr 22, 2020 · 1 min read · notes.mukyu.dev  
Updated Oct 27  
Read the article

-   [#cpp](https://hashnode.com/tag/cpp)

## Written by

[Patchouli](https://hashnode.com/@mudream4869)

@mudream4869 · Uohout

  
[View profile](https://hashnode.com/@mudream4869)

工程師帕秋莉~

後端工程師。 不定時張貼一些寫扣時的筆記，有時英文，有時中文。 「如果，我是魔女的話...」

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
