<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>silight_jp</author_name>
  <author_url>https://blog.hatena.ne.jp/silight_jp/</author_url>
  <blog_title>しらいとブログ</blog_title>
  <blog_url>https://silight.hatenablog.jp/</blog_url>
  <categories>
    <anon>プログラミング</anon>
    <anon>プログラミングテクニック</anon>
    <anon>C++</anon>
  </categories>
  <description>事の始まりはC++で遅延評価の必要性に駆られたことでした。 // 時間のかかる処理 int n = sum(list); // testの中でnが使われなければ処理が無駄になる test(n); そこで値の代わりに関数を渡し、必要になったときに評価してもらう方法を取りました。 auto f = [&amp;] { return sum(list); }; test(f); このやり方だと遅延評価は実現できますが、代償として値を直接渡すことができなくなりました。 test(100); // Error test([] { return 100; }); // OK そこで値と関数の両方を受け取れる関数を…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsilight.hatenablog.jp%2Fentry%2F2017%2F07%2F19%2F203301&quot; title=&quot;【C++11/14】値か関数を受け取り評価する関数 - しらいとブログ&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>2017-07-19 20:33:01</published>
  <title>【C++11/14】値か関数を受け取り評価する関数</title>
  <type>rich</type>
  <url>https://silight.hatenablog.jp/entry/2017/07/19/203301</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
