<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>faith_and_brave</author_name>
  <author_url>https://blog.hatena.ne.jp/faith_and_brave/</author_url>
  <blog_title>Faith and Brave - C++で遊ぼう</blog_title>
  <blog_url>https://faithandbrave.hateblo.jp/</blog_url>
  <categories>
    <anon>C++</anon>
  </categories>
  <description>Boost.Asioで非同期通信を書いていると、送受信のためのバッファをメンバ変数に持つ必要が出てきて、局所化が難しい場合があります。 この解決策として、以下のようなイディオムを使うことで送受信バッファをローカル変数化することができます： 送受信バッファをshared_ptrで包む async_read, async_writeにshared_ptrを間接参照したバッファを渡す このままでは送受信関数のスコープを抜けた時点でshared_ptrが消えてしまう 送受信のハンドラにshared_ptrのバッファをbindする io_serviceは内部でハンドラ関数のキューをメンバ変数として管理し…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ffaithandbrave.hateblo.jp%2Fentry%2F20110607%2F1307424963&quot; title=&quot; Boost.Asio 送受信バッファをメンバ変数に持たないためのイディオム - Faith and Brave - C++で遊ぼう&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2011-06-07 14:36:03</published>
  <title> Boost.Asio 送受信バッファをメンバ変数に持たないためのイディオム</title>
  <type>rich</type>
  <url>https://faithandbrave.hateblo.jp/entry/20110607/1307424963</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
