{"id":1027,"date":"2011-01-18T17:29:27","date_gmt":"2011-01-18T22:29:27","guid":{"rendered":"http:\/\/bitpost.com\/news\/?p=1027"},"modified":"2013-06-07T20:34:04","modified_gmt":"2013-06-08T01:34:04","slug":"c-delegates","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/","title":{"rendered":"C++ delegates"},"content":{"rendered":"<p>Just a quick note: I feel like I&#8217;ve accomplished a lot today just because I READ <a href=\"http:\/\/www.codeproject.com\/KB\/cpp\/FastDelegate.aspx\">this article<\/a>.  Nice bomb drop.  We&#8217;ll see what I do with it&#8230; I think it&#8217;s a bit too crunchy to put into use &#8211; I don&#8217;t feel like dealing with any gotchas on all the versions of all the compilers I&#8217;m using, as there are a LOT these days.  But it has lead me to research other progress in the C++ standard.  The <a href=\"http:\/\/www.boost.org\/doc\/libs\/1_45_0\/doc\/html\/function.html\">boost function library<\/a>, which has been accepted into TR1, is already available in some compiler spaces, whoop.  <\/p>\n<p>I started down this path because I wanted to store a predicate function in my sorted_vector class.  For now I can get by without this stuff, always passing in a functor to the function calls that need it, but that&#8217;s not as elegant.<\/p>\n<p>Meanwhile, it&#8217;s upwards and onwards with QT slots and signals &#8211; QT is getting the job done for me in a major way.  There are boost::signal and boost::bind as alternatives to that, but I&#8217;m really kicking out the jams with QT, so I&#8217;m not stopping now.  More to come soon, hopefully.<\/p>\n<p><strong>UPDATE<\/strong>: <a href=\"http:\/\/en.wikipedia.org\/wiki\/C%2B%2B0x\">C++0x<\/a> is hopefully coming soon.  Wikipedia, as usual, gives a nice overview and some nice guidance.  In particular, I need to avoid std::auto_ptr and function object base classes (std::unary_function, std::binary_function) which are <a href=\"http:\/\/en.wikipedia.org\/wiki\/C%2B%2B0x#Features_to_be_removed_or_deprecated\">slated for removal<\/a>(!).  Sounds like I need to keep my eye out for <a href=\"http:\/\/en.wikipedia.org\/wiki\/C%2B%2B0x#Polymorphic_wrappers_for_function_objects\">polymorphic wrappers for function objects<\/a>, they may be just the ticket I need.  Check out the whole standard, it&#8217;s juicy!  :><\/p>\n<p><strong>UPDATE 2<\/strong>: <a href=\"http:\/\/www.codeproject.com\/KB\/cpp\/Sort.aspx\">Here<\/a> is a nice rundown of options for the sort predicate function, leading into the C++0x solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just a quick note: I feel like I&#8217;ve accomplished a lot today just because I READ this article. Nice bomb drop. We&#8217;ll see what I do with it&#8230; I think it&#8217;s a bit too crunchy to put into use &#8211; I don&#8217;t feel like dealing with any gotchas on all the versions of all the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[22],"tags":[37,31,38,29,30,36],"class_list":["post-1027","post","type-post","status-publish","format-standard","hentry","category-cpp","tag-c0x","tag-data-structures","tag-delegates","tag-sorted_vector","tag-stl","tag-tr1"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Just a quick note: I feel like I&#039;ve accomplished a lot today just because I READ this article. Nice bomb drop. We&#039;ll see what I do with it... I think it&#039;s a bit too crunchy to put into use - I don&#039;t feel like dealing with any gotchas on all the versions of all the\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"m\"\/>\n\t<meta name=\"keywords\" content=\"c++\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/bitpost.com\/news\/2011\/c-delegates\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"bitpost.com\/news | Note to self\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"C++ delegates | bitpost.com\/news\" \/>\n\t\t<meta property=\"og:description\" content=\"Just a quick note: I feel like I&#039;ve accomplished a lot today just because I READ this article. Nice bomb drop. We&#039;ll see what I do with it... I think it&#039;s a bit too crunchy to put into use - I don&#039;t feel like dealing with any gotchas on all the versions of all the\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/bitpost.com\/news\/2011\/c-delegates\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2011-01-18T22:29:27+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2013-06-08T01:34:04+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"C++ delegates | bitpost.com\/news\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Just a quick note: I feel like I&#039;ve accomplished a lot today just because I READ this article. Nice bomb drop. We&#039;ll see what I do with it... I think it&#039;s a bit too crunchy to put into use - I don&#039;t feel like dealing with any gotchas on all the versions of all the\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#article\",\"name\":\"C++ delegates | bitpost.com\\\/news\",\"headline\":\"C++ delegates\",\"author\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg\",\"width\":96,\"height\":96,\"caption\":\"m\"},\"datePublished\":\"2011-01-18T17:29:27-05:00\",\"dateModified\":\"2013-06-07T20:34:04-04:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#webpage\"},\"articleSection\":\"C++, c++0x, data structures, delegates, sorted_vector, stl, tr1\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/bitpost.com\\\/news\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/tricks-tips-tools\\\/#listItem\",\"name\":\"Tricks Tips Tools\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/tricks-tips-tools\\\/#listItem\",\"position\":2,\"name\":\"Tricks Tips Tools\",\"item\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/tricks-tips-tools\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/tricks-tips-tools\\\/cpp\\\/#listItem\",\"name\":\"C++\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/tricks-tips-tools\\\/cpp\\\/#listItem\",\"position\":3,\"name\":\"C++\",\"item\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/tricks-tips-tools\\\/cpp\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#listItem\",\"name\":\"C++ delegates\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/tricks-tips-tools\\\/#listItem\",\"name\":\"Tricks Tips Tools\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#listItem\",\"position\":4,\"name\":\"C++ delegates\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/tricks-tips-tools\\\/cpp\\\/#listItem\",\"name\":\"C++\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#person\",\"name\":\"m\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg\",\"width\":96,\"height\":96,\"caption\":\"m\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/#author\",\"url\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/\",\"name\":\"m\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg\",\"width\":96,\"height\":96,\"caption\":\"m\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#webpage\",\"url\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/\",\"name\":\"C++ delegates | bitpost.com\\\/news\",\"description\":\"Just a quick note: I feel like I've accomplished a lot today just because I READ this article. Nice bomb drop. We'll see what I do with it... I think it's a bit too crunchy to put into use - I don't feel like dealing with any gotchas on all the versions of all the\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2011\\\/c-delegates\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/#author\"},\"datePublished\":\"2011-01-18T17:29:27-05:00\",\"dateModified\":\"2013-06-07T20:34:04-04:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#website\",\"url\":\"https:\\\/\\\/bitpost.com\\\/news\\\/\",\"name\":\"bitpost.com\\\/news\",\"description\":\"Note to self\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"C++ delegates | bitpost.com\/news","description":"Just a quick note: I feel like I've accomplished a lot today just because I READ this article. Nice bomb drop. We'll see what I do with it... I think it's a bit too crunchy to put into use - I don't feel like dealing with any gotchas on all the versions of all the","canonical_url":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/","robots":"max-image-preview:large","keywords":"c++","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#article","name":"C++ delegates | bitpost.com\/news","headline":"C++ delegates","author":{"@id":"https:\/\/bitpost.com\/news\/author\/m\/#author"},"publisher":{"@id":"https:\/\/bitpost.com\/news\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg","width":96,"height":96,"caption":"m"},"datePublished":"2011-01-18T17:29:27-05:00","dateModified":"2013-06-07T20:34:04-04:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#webpage"},"isPartOf":{"@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#webpage"},"articleSection":"C++, c++0x, data structures, delegates, sorted_vector, stl, tr1"},{"@type":"BreadcrumbList","@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news#listItem","position":1,"name":"Home","item":"https:\/\/bitpost.com\/news","nextItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/tricks-tips-tools\/#listItem","name":"Tricks Tips Tools"}},{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/tricks-tips-tools\/#listItem","position":2,"name":"Tricks Tips Tools","item":"https:\/\/bitpost.com\/news\/category\/tricks-tips-tools\/","nextItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/tricks-tips-tools\/cpp\/#listItem","name":"C++"},"previousItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/tricks-tips-tools\/cpp\/#listItem","position":3,"name":"C++","item":"https:\/\/bitpost.com\/news\/category\/tricks-tips-tools\/cpp\/","nextItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#listItem","name":"C++ delegates"},"previousItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/tricks-tips-tools\/#listItem","name":"Tricks Tips Tools"}},{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#listItem","position":4,"name":"C++ delegates","previousItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/tricks-tips-tools\/cpp\/#listItem","name":"C++"}}]},{"@type":"Person","@id":"https:\/\/bitpost.com\/news\/#person","name":"m","image":{"@type":"ImageObject","@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg","width":96,"height":96,"caption":"m"}},{"@type":"Person","@id":"https:\/\/bitpost.com\/news\/author\/m\/#author","url":"https:\/\/bitpost.com\/news\/author\/m\/","name":"m","image":{"@type":"ImageObject","@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg","width":96,"height":96,"caption":"m"}},{"@type":"WebPage","@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#webpage","url":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/","name":"C++ delegates | bitpost.com\/news","description":"Just a quick note: I feel like I've accomplished a lot today just because I READ this article. Nice bomb drop. We'll see what I do with it... I think it's a bit too crunchy to put into use - I don't feel like dealing with any gotchas on all the versions of all the","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/bitpost.com\/news\/#website"},"breadcrumb":{"@id":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/#breadcrumblist"},"author":{"@id":"https:\/\/bitpost.com\/news\/author\/m\/#author"},"creator":{"@id":"https:\/\/bitpost.com\/news\/author\/m\/#author"},"datePublished":"2011-01-18T17:29:27-05:00","dateModified":"2013-06-07T20:34:04-04:00"},{"@type":"WebSite","@id":"https:\/\/bitpost.com\/news\/#website","url":"https:\/\/bitpost.com\/news\/","name":"bitpost.com\/news","description":"Note to self","inLanguage":"en-US","publisher":{"@id":"https:\/\/bitpost.com\/news\/#person"}}]},"og:locale":"en_US","og:site_name":"bitpost.com\/news | Note to self","og:type":"article","og:title":"C++ delegates | bitpost.com\/news","og:description":"Just a quick note: I feel like I've accomplished a lot today just because I READ this article. Nice bomb drop. We'll see what I do with it... I think it's a bit too crunchy to put into use - I don't feel like dealing with any gotchas on all the versions of all the","og:url":"https:\/\/bitpost.com\/news\/2011\/c-delegates\/","article:published_time":"2011-01-18T22:29:27+00:00","article:modified_time":"2013-06-08T01:34:04+00:00","twitter:card":"summary","twitter:title":"C++ delegates | bitpost.com\/news","twitter:description":"Just a quick note: I feel like I've accomplished a lot today just because I READ this article. Nice bomb drop. We'll see what I do with it... I think it's a bit too crunchy to put into use - I don't feel like dealing with any gotchas on all the versions of all the"},"aioseo_meta_data":{"post_id":"1027","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-13 19:49:25","updated":"2025-08-17 19:07:48","seo_analyzer_scan_date":null},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-gz","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/1027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=1027"}],"version-history":[{"count":9,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/1027\/revisions"}],"predecessor-version":[{"id":1625,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/1027\/revisions\/1625"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=1027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=1027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=1027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}