<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
  <title type="html">김 용묵의 절대공간 - 블로그: C11에서-추가된-R-value-참조자에 달린 최근 댓글/트랙백 목록</title>
  <id>http://moogi.new21.org/tc/</id>
  <link rel="alternate" type="text/html" hreflang="ko" href="http://moogi.new21.org/tc/" />
  <subtitle type="html">철도를 명절 때에나 떠오르는 4대 교통수단 중 하나로만 아는 것은, 예수님을 사대성인· 성인군자 중 하나로만 아는 것과 같다.</subtitle>
  <updated>2022-05-06T12:48:51+09:00</updated>
  <generator>Textcube 1.7.8 : Con moto</generator>
  <entry>
    <title type="html">Lyn님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3179" />
    <author>
      <name>(Lyn)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3179</id>
    <published>2012-05-16T11:06:30+09:00</published>
    <summary type="html">move constructor 만쉐~</summary>
  </entry>
  <entry>
    <title type="html">Lyn님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3180" />
    <author>
      <name>(Lyn)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3180</id>
    <published>2012-05-16T11:08:05+09:00</published>
    <summary type="html">레퍼런스-&amp;gt;RValue 레퍼런스로 변경해주는 std::move 함수가 추가되었습니다 : )</summary>
  </entry>
  <entry>
    <title type="html">아라크넹님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3181" />
    <author>
      <name>(아라크넹)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3181</id>
    <published>2012-05-16T11:55:45+09:00</published>
    <summary type="html">r-value reference의 또 다른 중요한 사용 용도는 메소드를 다른 객체의 메소드로 forwarding하는 경우가 있습니다. 사실 맨 마지막 예시의 변형이긴 하네요.

struct A { void foo(std::string, std::string&amp;amp;); };
struct B { A a; void foo(std::string, std::string&amp;amp;); };
void B::foo(std::string arg1, std::string&amp;amp; arg2) { a.foo(arg1, arg2); }

이 코드의 경우 B::foo는 A::foo로 forwarding하게 되지만 arg1을 옮기는 과정에서 복사 생성자를 거치게 됩니다. 하지만 B::foo를 다음과 같이 고치면:

void B::foo(std::string&amp;amp;&amp;amp; arg1, std::string&amp;amp; arg2) { a.foo(std::forward&amp;lt;std::string&amp;gt;(arg1), arg2); }

복사 생성자를 거치지 않게 됩니다. std::forward는 r-value를 받았으면 r-value를 반환하고 l-value를 받았으면 l-value를 반환하는 거 빼면 아무 변화도 주지 않는 identity function입니다.

다음 문서를 부분적으로 참고했습니다.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2027.html#Perfect_Forwarding
http://cpp-next.com/archive/2009/12/onward-forward/</summary>
  </entry>
  <entry>
    <title type="html">사무엘님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3182" />
    <author>
      <name>(사무엘)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3182</id>
    <published>2012-05-16T15:01:08+09:00</published>
    <summary type="html">네, 이동 생성자는 멋진 개념이죠. 그리고 본문에도 그 함수가 언급돼 있습니다. ^^</summary>
  </entry>
  <entry>
    <title type="html">사무엘님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3183" />
    <author>
      <name>(사무엘)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3183</id>
    <published>2012-05-16T15:01:18+09:00</published>
    <summary type="html">한 문법이 추가되면서 여러 방면의 문제를 한꺼번에 해결할 수 있죠(마치 팔방미인이 된 auto처럼). R-value 참조자도 그런 개념인 것 같습니다.</summary>
  </entry>
  <entry>
    <title type="html">Lyn님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3184" />
    <author>
      <name>(Lyn)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3184</id>
    <published>2012-05-16T15:34:23+09:00</published>
    <summary type="html">점점 코드가 암호화되어가고있습니다 ㅡㅜ

이제 대입버그도 두군데서 나오겠군요</summary>
  </entry>
  <entry>
    <title type="html">김 기윤님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3185" />
    <author>
      <name>(김 기윤)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3185</id>
    <published>2012-05-16T19:59:34+09:00</published>
    <summary type="html">C++11 스펙에서 봤던 것이긴 한데, 제대로 이해는 못 했었고, 지금도 제대로 이해를 못 했습니다(.....) 단지 좋은거다~ 라는 정도만 이해하고 있을 뿐.. orz..</summary>
  </entry>
  <entry>
    <title type="html">사무엘님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3186" />
    <author>
      <name>(사무엘)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3186</id>
    <published>2012-05-17T10:28:16+09:00</published>
    <summary type="html">요즘 스마트폰 때문에 뭐든지 &#039;스마트&#039;해졌다고 그러는데, R-value 참조자는 C++ 언어의 디자인과 C++ 라이브러리의 동작을 좀더 &#039;스마트&#039;하게 개선하는 효과가 있는 듯합니다. ^^
물론 C++은 처음 접하는 사람에게는 갈수록 더 배우기 어려운 복잡한 언어가 돼 가고 있죠.</summary>
  </entry>
  <entry>
    <title type="html">Lyn님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3187" />
    <author>
      <name>(Lyn)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3187</id>
    <published>2012-05-17T11:22:40+09:00</published>
    <summary type="html">한번쓰고 버릴 데이터를 대입할때 복사가 일어나지 않도록 한다!

라는것만 이해하면 나머진 쉽더라구요.
물론 전 사무엘님보다 능력이 딸려서 거의 1주일을 문서 들여다보고 고민 ㅜㅜ</summary>
  </entry>
  <entry>
    <title type="html">주의사신님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3188" />
    <author>
      <name>(주의사신)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3188</id>
    <published>2012-05-17T17:12:27+09:00</published>
    <summary type="html">졸업 작품 만들 적에 VC++ 10에 추가된 C++11을 많이 사용했는데, 안 그래도 어려운 C++이 더 어려워지는 느낌을 조금 받기는 했습니다.</summary>
  </entry>
  <entry>
    <title type="html">김 기윤님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3189" />
    <author>
      <name>(김 기윤)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3189</id>
    <published>2012-05-17T18:29:43+09:00</published>
    <summary type="html">오히려 람다가 훨씬 쉬워요 orz..</summary>
  </entry>
  <entry>
    <title type="html">사무엘님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3190" />
    <author>
      <name>(사무엘)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3190</id>
    <published>2012-05-18T10:58:28+09:00</published>
    <summary type="html">“나의 C++은 이런 언어가 아니라능!!” 하는 생각이 들죠. ㄲㄲㄲㄲㄲㄲ

static 멤버는 선언뿐만 아니라 정의도 밖에서 반드시 해 줘야 하게 바뀜 (1980년대 말)
템플릿 추가 (1990년대 초중반)
bool, namespace, typename, explicit, *_cast 등 추가 (1990년대 중반)
iostream.h에서 .h가 빠지고, C++ 라이브러리들도 std namespace로 이동 (1990년대 중후반)
export 흑역사
C++11 (2011년)

흠, 이런 역사에 대해서 정리해도 글 한편이 될 것 같네요.</summary>
  </entry>
  <entry>
    <title type="html">김재호님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3197" />
    <author>
      <name>(김재호)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3197</id>
    <published>2012-05-22T00:45:38+09:00</published>
    <summary type="html">저는 아라크넹님이 설명한 Perfect forwarding 에서 Perfect라는 단어가 잘 그려지지 않습니다. 마치 영어 시제에서 현재 완료를 말할 때 쓰는 Present Perfect 라는 단어를 접할 때의 맹한 느낌이랄까요.

그나저나 정리를 잘하셔서 글을 아주 잘 쓰셨네요. 긴 글인데도 참 재밌게 읽었습니다.</summary>
  </entry>
  <entry>
    <title type="html">사무엘님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3200" />
    <author>
      <name>(사무엘)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3200</id>
    <published>2012-05-22T13:37:51+09:00</published>
    <summary type="html">재미 있게 읽어 주셔서 고맙습니다. 글 내용이 잘 전달이 됐다니 다행이고요. ^^
저는 정보력이 아라크넹 님 만하지는 못하지만, 제가 확실하게 아는 내용은 최대한 남이 알기도 쉽게 풀이해서 글로 만들려고 늘 노력합니다.
또 얼마 후엔 C++11 관련 글이 올라올 겁니다.</summary>
  </entry>
  <entry>
    <title type="html">Lyn님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/683#comment3206" />
    <author>
      <name>(Lyn)</name>
    </author>
    <id>http://moogi.new21.org/tc/683#comment3206</id>
    <published>2012-05-23T13:42:12+09:00</published>
    <summary type="html">다음 표준은 가칭이 C++1y라네요 (이번에도 16진수냐?!)</summary>
  </entry>
</feed>
