<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>meryngii</author_name>
  <author_url>https://blog.hatena.ne.jp/meryngii/</author_url>
  <blog_title>meryngii.neta</blog_title>
  <blog_url>https://meryngii.hatenablog.com/</blog_url>
  <categories>
    <anon>C++</anon>
  </categories>
  <description>配列を返す関数 - meryngii.neta 以前に配列を返す関数は参照を使えば作れることを紹介したのだが、同じように関数の配列引数の要素数も調べることができるらしい。 #include &lt;iostream&gt; void f(int a[]) { std::cout &lt;&lt; (sizeof(a) / sizeof(int)); } int main() { int x[10]; f(x); } これは期待した動作をしてくれない。変数宣言でのint ar[]はint* arと同じ意味だから、fは常にintへのポインタの大きさを表示してしまう。 template &lt;std::size_t Size&gt;…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmeryngii.hatenablog.com%2Fentry%2F20090403%2F1238776034&quot; title=&quot;配列引数の要素数を調べる - meryngii.neta&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>2009-04-03 01:27:14</published>
  <title>配列引数の要素数を調べる</title>
  <type>rich</type>
  <url>https://meryngii.hatenablog.com/entry/20090403/1238776034</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
