<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>sile</author_name>
  <author_url>https://blog.hatena.ne.jp/sile/</author_url>
  <blog_title>sileのブログ</blog_title>
  <blog_url>https://sile.hatenablog.jp/</blog_url>
  <categories>
    <anon>C++</anon>
    <anon>utility</anon>
  </categories>
  <description>構造体やクラスのインスタンスの特定のフィールドのアドレス(ポインタ)だけ分かっている場合に、そこからオブジェクト全体のポインタを取得したい場合に使うマクロ。 やっていることは単にフィールドのアドレスから、そのフィールドの(クラスor構造体の)先頭からのオフセットを引いているだけ。 // type.fieldが、typeの先頭の何バイト目に配置されているかを求める #define field_offset(type, field) \ ((char*)&amp;(((type*)NULL)-&gt;field) - (char*)NULL) // type.filedのアドレス(field_ptr)から、fi…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsile.hatenablog.jp%2Fentry%2F20111201%2F1322671958&quot; title=&quot; フィールドのポインタから、オブジェクト全体のポインタを取得するためのマクロ - sileのブログ&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-12-01 01:52:38</published>
  <title> フィールドのポインタから、オブジェクト全体のポインタを取得するためのマクロ</title>
  <type>rich</type>
  <url>https://sile.hatenablog.jp/entry/20111201/1322671958</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
