{"id":745,"date":"2012-02-11T06:55:34","date_gmt":"2012-02-11T13:55:34","guid":{"rendered":"http:\/\/jaredrobinson.com\/blog\/?p=745"},"modified":"2012-02-11T06:56:44","modified_gmt":"2012-02-11T13:56:44","slug":"c-initializer-lists","status":"publish","type":"post","link":"https:\/\/jaredrobinson.com\/blog\/c-initializer-lists\/","title":{"rendered":"C++ initializer lists"},"content":{"rendered":"<p>One of the cool new features in C++ is initializer lists. Here&#8217;s an <a href=\"http:\/\/en.wikipedia.org\/wiki\/C%2B%2B11#Initializer_lists\">example from Wikipedia<\/a>:<\/p>\n<p><code><br \/>\nstruct Object<br \/>\n{<br \/>\n    float first;<br \/>\n    int second;<br \/>\n};<\/p>\n<p>Object scalar = {0.43f, 10}; \/\/ One Object, with first=0.43f and second=10<br \/>\nObject anArray[] = {{13.4f, 3}, {43.28f, 29}, {5.934f, 17}}; \/\/ An array of three Objects<br \/>\n<\/code><\/p>\n<p>There&#8217;s another <a href=\"http:\/\/stackoverflow.com\/questions\/907471\/c0x-initializer-list-example\">example over at stackoverflow<\/a>. <\/p>\n<p>IBM has published the useful <a href=\"http:\/\/www.ibm.com\/developerworks\/aix\/library\/au-gcc\/index.html\">C++0x feature support in GCC 4.5<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the cool new features in C++ is initializer lists. Here&#8217;s an example from Wikipedia: struct Object { float first; int second; }; Object scalar = {0.43f, 10}; \/\/ One Object, with first=0.43f and second=10 Object anArray[] = {{13.4f, 3}, {43.28f, 29}, {5.934f, 17}}; \/\/ An array of three Objects There&#8217;s another example over &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/jaredrobinson.com\/blog\/c-initializer-lists\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;C++ initializer lists&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,17],"tags":[],"class_list":["post-745","post","type-post","status-publish","format-standard","hentry","category-programming","category-tech"],"_links":{"self":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/comments?post=745"}],"version-history":[{"count":6,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/745\/revisions"}],"predecessor-version":[{"id":750,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/745\/revisions\/750"}],"wp:attachment":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/media?parent=745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/categories?post=745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/tags?post=745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}