{"id":3020,"date":"2017-05-11T09:19:39","date_gmt":"2017-05-11T08:19:39","guid":{"rendered":"http:\/\/roboblog.fatal-fury.de\/?p=3020"},"modified":"2017-05-11T09:21:42","modified_gmt":"2017-05-11T08:21:42","slug":"why-isnt-there-a-swap-function-in-fortran-and-c","status":"publish","type":"post","link":"http:\/\/roboblog.fatal-fury.de\/?p=3020","title":{"rendered":"C++ Guns - Why isn't there a swap function in Fortran and C?"},"content":{"rendered":"<p>Because Fortran and C sucks.<br \/>\nTo implement a generic swap function which works for any type and any custom type, one needs templates. Think about usually variables which store a value. Templates are variables which store types. But Fortran and C do not have template techniques. So one must implement a swap function for every type and any future custom type by himself. And pay the cost of a not-inline function call.<\/p>\n<p>With C++ you don't even have to think about it.<\/p>\n<pre><code>\r\ntemplate&ltclass T>\r\ninline void std::swap(T& a, T& b) noexcept;\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Because Fortran and C sucks. To implement a generic swap function which works for any type and any custom type, one needs templates. Think about usually variables which store a value. Templates are variables which store types. But Fortran and C do not have template techniques. So one must implement a swap function for every [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[14,17,30],"class_list":["post-3020","post","type-post","status-publish","format-standard","hentry","category-allgemein","tag-c","tag-cpp","tag-fortran"],"_links":{"self":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/3020","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3020"}],"version-history":[{"count":4,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/3020\/revisions"}],"predecessor-version":[{"id":3022,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/3020\/revisions\/3022"}],"wp:attachment":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3020"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}