<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Projections on Cheat Sheet</title><link>/tags/projections/</link><description>Recent content in Projections on Cheat Sheet</description><generator>Hugo</generator><language>en</language><atom:link href="/tags/projections/index.xml" rel="self" type="application/rss+xml"/><item><title>Pointers to Class Member</title><link>/programming/cpp/primer/pointers-to-class-member/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/programming/cpp/primer/pointers-to-class-member/</guid><description>&lt;h1 id="pointers-to-class-member"&gt;Pointers to Class Member&lt;a class="anchor" href="#pointers-to-class-member"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Summary based on &lt;em&gt;C++ Primer, 5th ed.&lt;/em&gt; Section 19.4: Pointers to Class Member, paired with modern C++ &lt;code&gt;std::invoke&lt;/code&gt; and C++20 Ranges projections.&lt;/p&gt;
&lt;h2 id="1-ordinary-pointers-vs-pointers-to-class-member---"&gt;1. Ordinary Pointers vs. Pointers to Class Member (&lt;code&gt;.*&lt;/code&gt;, &lt;code&gt;-&amp;gt;*&lt;/code&gt;)&lt;a class="anchor" href="#1-ordinary-pointers-vs-pointers-to-class-member---"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While an ordinary pointer &lt;code&gt;TYPE*&lt;/code&gt; stores the &lt;strong&gt;actual memory address of a specific live object&lt;/strong&gt;, a &lt;strong&gt;pointer to member &lt;code&gt;TYPE CLASS::*&lt;/code&gt;&lt;/strong&gt; stores no object address at all — it identifies &lt;strong&gt;which non-&lt;code&gt;static&lt;/code&gt; member within &lt;code&gt;CLASS&lt;/code&gt; to select&lt;/strong&gt;, such as its relative byte offset inside &lt;code&gt;CLASS&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>