{"id":3063,"date":"2018-07-14T00:14:45","date_gmt":"2018-07-13T22:14:45","guid":{"rendered":"https:\/\/mariusbancila.ro\/blog\/?p=3063"},"modified":"2018-07-14T00:14:45","modified_gmt":"2018-07-13T22:14:45","slug":"partial-function-applications","status":"publish","type":"post","link":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/","title":{"rendered":"Partial function applications"},"content":{"rendered":"<p>Partial function application is the process of taking a function with a number of arguments, fixing (or binding) some of its arguments and producing a new function with a smaller number of arguments. In C++, this can be achieved with <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/utility\/functional\/bind\">std::bind()<\/a> that generates a forwarding call wrapper for a callable object, and the placeholder objects from the <a href=\"\">std::placeholders<\/a> namespace that are used for binding arguments to the callable object.<\/p>\n<p><!-- more --><\/p>\n<p>To see how this works, let&#8217;s start with the following function that is supposed to print a document to a specified printer with various settings. These include page orientation and size, number of copies, size of margins, resolution, and scale. Some of these have default values because in most cases you&#8217;d use the same values for these arguments.<\/p>\n<pre class=\"lang:c++ decode:true \" >enum class page_size {Letter, A0, A1, A2, A3, A4, A5, A6};\r\nenum class page_layout {portrait, landscape};\r\nenum class page_margins {standard, minimum, maximum};\r\n\r\nvoid print(std::string_view destination,\r\n           page_layout const orientation,\r\n           page_size const size,\r\n           int const copies = 1,\r\n           page_margins const margins = page_margins::standard,\r\n           int const dpi = 300,\r\n           double const scale = 1.0)\r\n{\r\n  \/* print document *\/\r\n}<\/pre>\n<p>If you want to print to a printer called &#8220;Printer&#8221; one copy on an A4 page in portrait layout, with standard margins, 300 DPI and no scaling, then you make the following call, relying on the default values.<\/p>\n<pre class=\"lang:c++ decode:true \" >print(\"Printer\", page_layout::portrait, page_size::A4);<\/pre>\n<p>Should you need two copies of the document, you need to explicitly provide that argument in the call.<\/p>\n<pre class=\"lang:c++ decode:true \" >print(\"Printer\", page_layout::portrait, page_size::A4, 2);<\/pre>\n<p>What if you need to print with a different resolution, such as 600 DPI instead of 300? In C++, arguments are positional, they need to be supplied in the order defined by the function declaration. Other languages, such as C#, support named arguments so that you can provide arguments in any order given that you specify the name of the parameter. Because of this, however, when you need to specify other value than the default for the DPI, you also need to specify values for the number of copies and the margins. In other words, your call would look like this.<\/p>\n<pre class=\"lang:c++ decode:true \" >print(\"Printer\", \r\n      page_layout::portrait, \r\n      page_size::A4, \r\n      1, \r\n      page_margins::standard, \r\n      600);<\/pre>\n<p>This is where <tt>std::bind()<\/tt> can step in. Default arguments for function parameters and binding are different things, but the effects are somehow similar. For instance, if all we need to change is the page size and margins, we can leverage a partial function application on the original function (that may also have default arguments) and create a callable forwarding wrapper with placeholders for the parameters we need to supply on every call and fix values for the others. Placeholders are objects in the <tt>std::placeholders<\/tt> namespace called <tt>_1<\/tt>, <tt>_2<\/tt>, &#8230;, <tt>_N<\/tt> (where N is implementation defined), whose type is also an implementation detail (although it must be default and copy-constructible). <\/p>\n<pre class=\"lang:c++ decode:true \" >using namespace std::placeholders;\r\nauto fprint = std::bind(print, \"Printer\", page_layout::portrait, _1, 1, _2, 300, 1.0);\r\n\r\nfprint(page_size::Letter, page_margins::maximum);\r\nfprint(page_size::A3, page_margins::minimum);<\/pre>\n<p>In this example <tt>_1<\/tt> and <tt>_2<\/tt> are objects that are stored in the function object generatated by <tt>std::bind()<\/tt>. When the function object is invoked with arguments, each placeholder is replaced by the corresponding unbound argument (<tt>_1<\/tt> by the first argument, <tt>_2<\/tt> by the second, etc.). One thing to notice is that when creating a callable wrapper with <tt>std::bind()<\/tt> you must supply values even for the parameters with default arguments.<\/p>\n<p>Of course, you&#8217;re not going to create a binding for making one or two calls like that. But you may have situations when one function with multiple arguments could be called repeatedly within the same routine or algorithm with only some of them changed. In this case you can use <tt>std::bind()<\/tt>.<\/p>\n<p>It is also useful when you want to use a function with multiple arguments with a standard algorithm that expects fewer arguments than the function requires. In the following example, the <tt>print()<\/tt> function is used to print the same document to multiple printers. <tt>std::for_each<\/tt> is used for this purpose, although the only argument that is supplied to the function is the printer name. Therefore, a callable wrapper is created with <tt>std::bind()<\/tt>.<\/p>\n<pre class=\"lang:c++ decode:true \" >std::vector&lt;std::string&gt; printers{ \"Printer\", \"Default printer\", \"PDF printer\" };\r\nstd::for_each(\r\n   std::begin(printers), std::end(printers),\r\n   std::bind(print, _1, \r\n                    page_layout::portrait,\r\n                    page_size::A4,\r\n                    1,\r\n                    page_margins::standard,\r\n                    600,\r\n                    1.0));<\/pre>\n<p>In the examples so far, the <tt>print()<\/tt> function was a free function, but the process works the same with member functions too. In the following example, <tt>print()<\/tt> is a member of the <tt>document<\/tt> class.<\/p>\n<pre class=\"lang:c++ decode:true \" >struct document\r\n{\r\n   void print(std::string_view destination,\r\n      page_layout const orientation,\r\n      page_size const size,\r\n      int const copies = 1,\r\n      page_margins const margins = page_margins::standard,\r\n      int const dpi = 300,\r\n      double const scale = 1.0)\r\n   {\r\n      \/* print document *\/\r\n   }\r\n};<\/pre>\n<p>To invoke this member function on a particular instance of the class you must suply the object as an argument to <tt>std::bind()<\/tt>; the rest is the same.<\/p>\n<pre class=\"lang:c++ decode:true \" >document doc;\r\nauto fprint = std::bind(&amp;document::print, &amp;doc, \"Printer\", page_layout::portrait, _1, 1, _2, 300, 1.0);\r\n\r\nfprint(page_size::Letter, page_margins::maximum);\r\nfprint(page_size::A3, page_margins::minimum);<\/pre>\n<pre class=\"lang:c++ decode:true \" >std::for_each(\r\n   std::begin(printers), std::end(printers),\r\n   std::bind(&amp;document::print, &amp;doc, _1,\r\n                                     page_layout::portrait,\r\n                                     page_size::A4,\r\n                                     1,\r\n                                     page_margins::standard,\r\n                                     600,\r\n                                     1.0));<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Partial function application is the process of taking a function with a number of arguments, fixing (or binding) some of its arguments and producing a new function with a smaller number of arguments. In C++, this can be achieved with <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/utility\/functional\/bind\">std::bind()<\/a> that generates a forwarding call wrapper for a callable object, and the placeholder objects from the <a href=\"\">std::placeholders<\/a> namespace that are used for binding arguments to the callable object.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","_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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[7],"tags":[451,223,561],"class_list":["post-3063","post","type-post","status-publish","format-standard","hentry","category-c","tag-c","tag-functional","tag-placeholders"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Marius Bancila\"\/>\n\t<meta name=\"keywords\" content=\"c++,functional,placeholders\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Marius Bancila&#039;s Blog | About code. Mostly on C++\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Partial function applications\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2018-07-13T22:14:45+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2018-07-13T22:14:45+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Partial function applications\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/#article\",\"name\":\"Partial function applications\",\"headline\":\"Partial function applications\",\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"},\"datePublished\":\"2018-07-14T00:14:45+02:00\",\"dateModified\":\"2018-07-14T00:14:45+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/#webpage\"},\"articleSection\":\"C++, C++, functional, placeholders\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"position\":2,\"name\":\"IT\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"position\":3,\"name\":\"Software\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"name\":\"C++\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"position\":4,\"name\":\"C++\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/#listItem\",\"name\":\"Partial function applications\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/#listItem\",\"position\":5,\"name\":\"Partial function applications\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"name\":\"C++\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Marius Bancila\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Marius Bancila\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/#webpage\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/\",\"name\":\"Partial function applications\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/07\\\/14\\\/partial-function-applications\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2018-07-14T00:14:45+02:00\",\"dateModified\":\"2018-07-14T00:14:45+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Partial function applications","description":"","canonical_url":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/","robots":"max-image-preview:large","keywords":"c++,functional,placeholders","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/#article","name":"Partial function applications","headline":"Partial function applications","author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"},"datePublished":"2018-07-14T00:14:45+02:00","dateModified":"2018-07-14T00:14:45+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/#webpage"},"isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/#webpage"},"articleSection":"C++, C++, functional, placeholders"},{"@type":"BreadcrumbList","@id":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/mariusbancila.ro\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","position":2,"name":"IT","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","position":3,"name":"Software","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","name":"C++"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","position":4,"name":"C++","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/#listItem","name":"Partial function applications"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/#listItem","position":5,"name":"Partial function applications","previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","name":"C++"}}]},{"@type":"Organization","@id":"https:\/\/mariusbancila.ro\/blog\/#organization","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","url":"https:\/\/mariusbancila.ro\/blog\/"},{"@type":"Person","@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author","url":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/","name":"Marius Bancila","image":{"@type":"ImageObject","@id":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g","width":96,"height":96,"caption":"Marius Bancila"}},{"@type":"WebPage","@id":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/#webpage","url":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/","name":"Partial function applications","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/#breadcrumblist"},"author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"datePublished":"2018-07-14T00:14:45+02:00","dateModified":"2018-07-14T00:14:45+02:00"},{"@type":"WebSite","@id":"https:\/\/mariusbancila.ro\/blog\/#website","url":"https:\/\/mariusbancila.ro\/blog\/","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","inLanguage":"en-US","publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Marius Bancila's Blog | About code. Mostly on C++","og:type":"article","og:title":"Partial function applications","og:url":"https:\/\/mariusbancila.ro\/blog\/2018\/07\/14\/partial-function-applications\/","article:published_time":"2018-07-13T22:14:45+00:00","article:modified_time":"2018-07-13T22:14:45+00:00","twitter:card":"summary","twitter:title":"Partial function applications"},"aioseo_meta_data":{"post_id":"3063","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,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-18 21:04:51","updated":"2025-12-12 07:50:13","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"author_meta":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"featured_img":null,"jetpack_publicize_connections":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"Partial function application is the process of taking a function with a number of arguments, fixing (or binding) some of its arguments and producing a new function with a smaller number of arguments. In C++, this can be achieved with std::bind() that generates a forwarding call wrapper for a callable object, and the placeholder objects&hellip;","coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">C++<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">C++<\/span>"]},"tags":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">C++<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">functional<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">placeholders<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">C++<\/span>","<span class=\"advgb-post-tax-term\">functional<\/span>","<span class=\"advgb-post-tax-term\">placeholders<\/span>"]}},"comment_count":"0","relative_dates":{"created":"Posted 8 years ago","modified":"Updated 8 years ago"},"absolute_dates":{"created":"Posted on July 14, 2018","modified":"Updated on July 14, 2018"},"absolute_dates_time":{"created":"Posted on July 14, 2018 12:14 am","modified":"Updated on July 14, 2018 12:14 am"},"featured_img_caption":"","series_order":"","jetpack_shortlink":"https:\/\/wp.me\/pYNdv-Np","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/3063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/comments?post=3063"}],"version-history":[{"count":13,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/3063\/revisions"}],"predecessor-version":[{"id":3077,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/3063\/revisions\/3077"}],"wp:attachment":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/media?parent=3063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/categories?post=3063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/tags?post=3063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}