{"id":834,"date":"2018-02-24T13:55:18","date_gmt":"2018-02-24T12:55:18","guid":{"rendered":"https:\/\/www.numbercrunch.de\/blog\/?p=834"},"modified":"2023-01-10T23:18:50","modified_gmt":"2023-01-10T22:18:50","slug":"range-based-for-loops-with-counters","status":"publish","type":"post","link":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/","title":{"rendered":"Range-based for loops with counters"},"content":{"rendered":"<p style=\"text-align: justify;\">In C++11 we got <a href=\"http:\/\/en.cppreference.com\/w\/cpp\/language\/range-for\">range-based for loops<\/a> which allow one to iterate over the elements of a container easily. In some situations, however, having sequential access to each element of the container is not sufficient for the task that shall be done in the loop body. Commonly an additional counting index is required. In this case the auxiliary counting variable has to be declared outside of the loop, which pollutes the surrounding namespace. Furthermore, the counting index is not increased automatically in each round.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">std::size_t i=0; \nfor (auto v : {3.14, 42., 77.}) {\n  \/\/ do something with value v and index i\n  ++i;\n}\n<\/pre>\n<p style=\"text-align: justify;\">Python has a build-in function <code>enumerate<\/code> which solves this task in a much more elegant way. It returns an iterator to iterate over the values of a container and over a set of indices simultaneously.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">l=['foo', 'bar', 42]\nfor i, value in enumerate(l):\n    print(i, value)<\/pre>\n<p style=\"text-align: justify;\">This very nice Python syntax relies on <a href=\"https:\/\/docs.python.org\/3\/tutorial\/datastructures.html#tuples-and-sequences\">tuple unpacking<\/a>. With <a href=\"http:\/\/en.cppreference.com\/w\/cpp\/language\/structured_binding\">structured binding declarations<\/a>, a similar language feature has been introduced to C++, too. This allows us to implement Python&#8217;s <code>enumerate<\/code> function in modern C++. First, we need an iterator adapter, which wraps an iterator into a pair of an iterator and an integer index.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">template&lt;typename iterator_type&gt;\nclass enumerate_iterator {\npublic:\n  using iterator=iterator_type;\n  using reference=typename std::iterator_traits&lt;iterator&gt;::reference;\n  using index_type=typename std::iterator_traits&lt;iterator&gt;::difference_type;\nprivate:\n  iterator iter;\n  index_type index=0;\npublic:\n  enumerate_iterator()=delete;\n  explicit enumerate_iterator(iterator iter, index_type start)\n    : iter(iter), index(start) {\n  }\n  enumerate_iterator &amp;operator++() {\n    ++iter;\n    ++index;\n    return *this;\n  }\n  bool operator==(const enumerate_iterator &amp;other) const {\n    return iter==other.iter;\n  }\n  bool operator!=(const enumerate_iterator &amp;other) const {\n    return iter!=other.iter;\n  }\n  std::pair&lt;reference, const index_type &amp;&gt; operator*() const {\n    return { *iter, index };\n  }\n};<\/pre>\n<p style=\"text-align: justify;\">A range-based for loop requires an object for which <code>begin<\/code> and <code>end<\/code> member functions or free functions are defined. Thus, we write a pseudo container, which wraps a range given by two iterators into a range of enumerate iterators, as defined above.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">template&lt;typename iterator_type&gt;\nclass enumerate_range {\npublic:\n  using iterator=enumerate_iterator&lt;iterator_type&gt;;\n  using index_type=typename std::iterator_traits&lt;iterator_type&gt;::difference_type;\nprivate:\n  const iterator_type first, last;\n  const index_type start;\npublic:\n  enumerate_range()=delete;\n  explicit enumerate_range(iterator_type first, iterator_type last,\n               index_type start=0)\n    : first(first), last(last), start(start) {\n  }\n  iterator begin() const {\n    return iterator(first, start);\n  }\n  iterator end() const {\n    return iterator(last, start);\n  }\n};<\/pre>\n<p style=\"text-align: justify;\">Now, we are already almost finished. With the two helper classes <code>enumerate_iterator<\/code> and <code>enumerate_range<\/code>, the implementation of the <code>enumerate<\/code> function reduces to the creation of an <code>enumerate_range<\/code> object from the function&#8217;s parameters. For convenience, the <code>enumerate<\/code> function is overloaded and has a default starting index zero.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">\/\/ convert a range given by two iterators [first, last) into a range\n\/\/ of enumerate iterators\ntemplate&lt;typename iterator_type&gt;\ndecltype(auto) enumerate(iterator_type first, iterator_type last,\n             typename std::iterator_traits&lt;iterator_type&gt;::difference_type start=0) {\n  return enumerate_range(first, last, start);\n}\n\n\/\/ convert an initializer list into a range of enumerate iterators\ntemplate&lt;typename type&gt;\ndecltype(auto) enumerate(const std::initializer_list&lt;type&gt; &amp;content,\n             std::ptrdiff_t start=0) {\n  return enumerate_range(content.begin(), content.end(), start);\n}\n\n\/\/ convert a C-array into a range of enumerate iterators\ntemplate&lt;typename type, std::size_t N&gt;\ndecltype(auto) enumerate(type (&amp;content)[N],\n             std::ptrdiff_t start=0) {\n  return enumerate_range(content, content+N, start);\n}\n<\/pre>\n<p style=\"text-align: justify;\">Utilizing structured bindings, a range-based for loop with counter becomes with the <code>enumerate<\/code> function:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">const std::vector&lt;int&gt; a({1, 2, 3, 4, 5, 6, 7, 8});\nfor (auto [value, index] : enumerate(a)) \n  std::cout &lt;&lt; index &lt;&lt; '\\t' &lt;&lt; value &lt;&lt; '\\n';<\/pre>\n<p style=\"text-align: justify;\">Finally, the listing below shows some working examples of range-based for loops with a counter variable in C++17. Note the versatile usage of the <code>enumerate<\/code> function as illustrated in the <code>main<\/code> routine.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">#include &lt;cstdlib&gt;\n#include &lt;iostream&gt;\n#include &lt;iterator&gt;\n#include &lt;initializer_list&gt;\n#include &lt;vector&gt;\n#include &lt;set&gt;\n\n\/\/ wraps an iterator into a pair of an iterator and an integer index\ntemplate&lt;typename iterator_type&gt;\nclass enumerate_iterator {\npublic:\n  using iterator=iterator_type;\n  using reference=typename std::iterator_traits&lt;iterator&gt;::reference;\n  using index_type=typename std::iterator_traits&lt;iterator&gt;::difference_type;\nprivate:\n  iterator iter;\n  index_type index=0;\npublic:\n  enumerate_iterator()=delete;\n  explicit enumerate_iterator(iterator iter, index_type start)\n    : iter(iter), index(start) {\n  }\n  enumerate_iterator &amp;operator++() {\n    ++iter;\n    ++index;\n    return *this;\n  }\n  bool operator==(const enumerate_iterator &amp;other) const {\n    return iter==other.iter;\n  }\n  bool operator!=(const enumerate_iterator &amp;other) const {\n    return iter!=other.iter;\n  }\n  std::pair&lt;reference, const index_type &amp;&gt; operator*() const {\n    return { *iter, index };\n  }\n};\n\n\/\/ pseudo container, wraps a range given by two iterators [first, last)\n\/\/ into a range of enumerate iterators\ntemplate&lt;typename iterator_type&gt;\nclass enumerate_range {\npublic:\n  using iterator=enumerate_iterator&lt;iterator_type&gt;;\n  using index_type=typename std::iterator_traits&lt;iterator_type&gt;::difference_type;\nprivate:\n  const iterator_type first, last;\n  const index_type start;\npublic:\n  enumerate_range()=delete;\n  explicit enumerate_range(iterator_type first, iterator_type last,\n               index_type start=0)\n    : first(first), last(last), start(start) {\n  }\n  iterator begin() const {\n    return iterator(first, start);\n  }\n  iterator end() const {\n    return iterator(last, start);\n  }\n};\n\n\/\/ convert a conatainer into a range of enumerate iterators\ntemplate&lt;typename container_type&gt;\ndecltype(auto) enumerate(container_type &amp;content,\n             typename std::iterator_traits&lt;typename container_type::iterator&gt;::difference_type start=0) {\n  using ::std::begin;\n  using ::std::end;\n  return enumerate_range(begin(content), end(content), start);\n}\n\n\/\/ convert a range given by two iterators [first, last) into a range\n\/\/ of enumerate iterators\ntemplate&lt;typename iterator_type&gt;\ndecltype(auto) enumerate(iterator_type first, iterator_type last,\n             typename std::iterator_traits&lt;iterator_type&gt;::difference_type start=0) {\n  return enumerate_range(first, last, start);\n}\n\n\/\/ convert an initializer list into a range of enumerate iterators\ntemplate&lt;typename type&gt;\ndecltype(auto) enumerate(const std::initializer_list&lt;type&gt; &amp;content,\n             std::ptrdiff_t start=0) {\n  return enumerate_range(content.begin(), content.end(), start);\n}\n\n\/\/ convert a C-array into a range of enumerate iterators\ntemplate&lt;typename type, std::size_t N&gt;\ndecltype(auto) enumerate(type (&amp;content)[N],\n             std::ptrdiff_t start=0) {\n  return enumerate_range(content, content+N, start);\n}\n\nint main() {\n  \/\/ test the enumberate function\n  {\n    int a[8]={1, 2, 3, 4, 5, 6, 7, 8};\n    \/\/ note that value and index have a reference type\n    for (auto [value, index] : enumerate(a)) {\n      value*=2;\n      std::cout &lt;&lt; index &lt;&lt; '\\t' &lt;&lt; value &lt;&lt; '\\n';\n    }\n    std::cout &lt;&lt; '\\n';\n  }\n  {\n    for (auto [value, index] : enumerate({4, 2, 1, 3, 8, 7, 6, 5})) \n      std::cout &lt;&lt; index &lt;&lt; '\\t' &lt;&lt; value &lt;&lt; '\\n';\n    std::cout &lt;&lt; '\\n';\n  }\n  {\n    const std::vector&lt;int&gt; a({1, 2, 3, 4, 5, 6, 7, 8});\n    for (auto [value, index] : enumerate(a, 8)) \n      std::cout &lt;&lt; index &lt;&lt; '\\t' &lt;&lt; value &lt;&lt; '\\n';\n    std::cout &lt;&lt; '\\n';\n  }\n  {\n    const std::set&lt;int&gt; a({4, 2, 1, 3, 8, 7, 6, 5});\n    for (auto [value, index] : enumerate(a)) \n      std::cout &lt;&lt; index &lt;&lt; '\\t' &lt;&lt; value &lt;&lt; '\\n';\n    std::cout &lt;&lt; '\\n';\n  }\n  return EXIT_SUCCESS;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In C++11 we got range-based for loops which allow one to iterate over the elements of a container easily. In some situations, however, having sequential access to each element of the container is not sufficient for the task that shall be done in the loop body. Commonly an additional counting index is required. In this&hellip; <a href=\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Range-based for loops with counters<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,5],"tags":[],"class_list":["post-834","post","type-post","status-publish","format-standard","hentry","category-c","category-software"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Range-based for loops with counters - Number Crunch<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Range-based for loops with counters - Number Crunch\" \/>\n<meta property=\"og:description\" content=\"In C++11 we got range-based for loops which allow one to iterate over the elements of a container easily. In some situations, however, having sequential access to each element of the container is not sufficient for the task that shall be done in the loop body. Commonly an additional counting index is required. In this&hellip; Continue reading Range-based for loops with counters\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/\" \/>\n<meta property=\"og:site_name\" content=\"Number Crunch\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-24T12:55:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-10T22:18:50+00:00\" \/>\n<meta name=\"author\" content=\"Heiko Bauke\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Heiko Bauke\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/\"},\"author\":{\"name\":\"Heiko Bauke\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413\"},\"headline\":\"Range-based for loops with counters\",\"datePublished\":\"2018-02-24T12:55:18+00:00\",\"dateModified\":\"2023-01-10T22:18:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/\"},\"wordCount\":302,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413\"},\"articleSection\":[\"C++\",\"Software\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/\",\"url\":\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/\",\"name\":\"Range-based for loops with counters - Number Crunch\",\"isPartOf\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#website\"},\"datePublished\":\"2018-02-24T12:55:18+00:00\",\"dateModified\":\"2023-01-10T22:18:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.numbercrunch.de\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Range-based for loops with counters\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#website\",\"url\":\"https:\/\/www.numbercrunch.de\/blog\/\",\"name\":\"Number Crunch\",\"description\":\"A computational science blog.\",\"publisher\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.numbercrunch.de\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413\",\"name\":\"Heiko Bauke\",\"logo\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Range-based for loops with counters - Number Crunch","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/","og_locale":"en_US","og_type":"article","og_title":"Range-based for loops with counters - Number Crunch","og_description":"In C++11 we got range-based for loops which allow one to iterate over the elements of a container easily. In some situations, however, having sequential access to each element of the container is not sufficient for the task that shall be done in the loop body. Commonly an additional counting index is required. In this&hellip; Continue reading Range-based for loops with counters","og_url":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/","og_site_name":"Number Crunch","article_published_time":"2018-02-24T12:55:18+00:00","article_modified_time":"2023-01-10T22:18:50+00:00","author":"Heiko Bauke","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Heiko Bauke","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/#article","isPartOf":{"@id":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/"},"author":{"name":"Heiko Bauke","@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413"},"headline":"Range-based for loops with counters","datePublished":"2018-02-24T12:55:18+00:00","dateModified":"2023-01-10T22:18:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/"},"wordCount":302,"commentCount":3,"publisher":{"@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413"},"articleSection":["C++","Software"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/","url":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/","name":"Range-based for loops with counters - Number Crunch","isPartOf":{"@id":"https:\/\/www.numbercrunch.de\/blog\/#website"},"datePublished":"2018-02-24T12:55:18+00:00","dateModified":"2023-01-10T22:18:50+00:00","breadcrumb":{"@id":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.numbercrunch.de\/blog\/2018\/02\/range-based-for-loops-with-counters\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.numbercrunch.de\/blog\/"},{"@type":"ListItem","position":2,"name":"Range-based for loops with counters"}]},{"@type":"WebSite","@id":"https:\/\/www.numbercrunch.de\/blog\/#website","url":"https:\/\/www.numbercrunch.de\/blog\/","name":"Number Crunch","description":"A computational science blog.","publisher":{"@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.numbercrunch.de\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413","name":"Heiko Bauke","logo":{"@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/posts\/834"}],"collection":[{"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/comments?post=834"}],"version-history":[{"count":13,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/posts\/834\/revisions"}],"predecessor-version":[{"id":946,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/posts\/834\/revisions\/946"}],"wp:attachment":[{"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/media?parent=834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/categories?post=834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/tags?post=834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}