{"id":1055,"date":"2022-08-30T15:11:38","date_gmt":"2022-08-30T15:11:38","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/c-comparing-member-function-pointers-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:11:38","modified_gmt":"2022-08-30T15:11:38","slug":"c-comparing-member-function-pointers-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/c-comparing-member-function-pointers-collection-of-common-programming-errors\/","title":{"rendered":"C++ Comparing Member Function Pointers-Collection of common programming errors"},"content":{"rendered":"<p>Member function pointers are not actual pointers. You should look at them as opaque structs. What does a method pointer contain:<\/p>\n<pre><code> struct method_pointer {\n     bool method_is_virtual;\n     union {\n         unsigned vtable_offset; \/\/ for a virtual function, need the vtable entry\n         void* function_pointer; \/\/ otherwise need the pointer to the concrete method\n     }\n };\n<\/code><\/pre>\n<p>If you could cast this to void* (you can&#8217;t) all you would have is a pointer the the struct, not a pointer to code. That&#8217;s why operator<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:20:00. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Member function pointers are not actual pointers. You should look at them as opaque structs. What does a method pointer contain: struct method_pointer { bool method_is_virtual; union { unsigned vtable_offset; \/\/ for a virtual function, need the vtable entry void* function_pointer; \/\/ otherwise need the pointer to the concrete method } }; If you could [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1055","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1055","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1055"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1055\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}