<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>编程语言 on 我的博客</title><link>https://quhongbin.github.io/categories/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/</link><description>Recent content in 编程语言 on 我的博客</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Mon, 31 Aug 2026 00:00:00 +0800</lastBuildDate><atom:link href="https://quhongbin.github.io/categories/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/index.xml" rel="self" type="application/rss+xml"/><item><title>constexpr 与编译期求值顺序</title><link>https://quhongbin.github.io/notes/constexpr-eval-order/</link><pubDate>Mon, 31 Aug 2026 00:00:00 +0800</pubDate><guid>https://quhongbin.github.io/notes/constexpr-eval-order/</guid><description>&lt;p&gt;&lt;code&gt;constexpr&lt;/code&gt; 函数&lt;strong&gt;不保证&lt;/strong&gt;在编译期求值。只有在需要常量表达式的场合——数组长度、模板实参、&lt;code&gt;static_assert&lt;/code&gt;——编译器才强制走编译期；其它情况下它可以退化成普通的函数调用。&lt;/p&gt;</description></item><item><title>C++ Templates</title><link>https://quhongbin.github.io/posts/1/01/c-templates/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://quhongbin.github.io/posts/1/01/c-templates/</guid><description>&lt;h1 id="c-templates"&gt;C++ Templates&lt;/h1&gt;&#10;&lt;p&gt;Templates are C++'s mechanism for &lt;strong&gt;generic programming&lt;/strong&gt; &amp;mdash; writing&#10;code that works with any type without repeating yourself. Unlike runtime&#10;polymorphism (virtual functions), templates are resolved entirely at&#10;compile time: the compiler generates a separate copy of the function or&#10;class for each set of type arguments actually used. This is called&#10;&lt;strong&gt;template instantiation&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Templates are the foundation of the C++ Standard Library:&#10;&lt;code&gt;std::vector&amp;lt;int&amp;gt;&lt;/code&gt;, &lt;code&gt;std::map&amp;lt;std::string, double&amp;gt;&lt;/code&gt;,&#10;&lt;code&gt;std::sort(begin, end)&lt;/code&gt; &amp;mdash; all templates. They power everything from&#10;containers to algorithms to smart pointers. Understanding templates&#10;deeply means understanding how modern C++ achieves its combination of&#10;abstraction and zero-overhead performance.&lt;/p&gt;</description></item></channel></rss>