<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog blog("Baptiste Wicht"); (Posts about C++23)</title><link>https://baptiste-wicht.com/</link><description></description><atom:link href="https://baptiste-wicht.com/categories/c%2B%2B23.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><lastBuildDate>Sun, 15 Feb 2026 06:57:39 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>C++ Refresh and new technos: FP16 and AVX512</title><link>https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html</link><dc:creator>Baptiste Wicht</dc:creator><description>&lt;p&gt;In the last few months, I have been working on refreshing my Expression Templates Library (ETL) project with modern
C++. I am happy to report that I have now finished the refresh. It took me longer than I expected and I also had less
time than I expected. But I am very happy about the result.&lt;/p&gt;
&lt;p&gt;The main change in etl is the use of concepts. Expression Templates are making heavy use of SFINAE. And I was able to
replace every single usage of SFINAE with concepts. I was also able to replace many assertions with concepts instead.&lt;/p&gt;
&lt;p&gt;In most cases, I am using concepts instead of the &lt;cite&gt;typename&lt;/cite&gt; declaration. For instance&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code cpp"&gt;&lt;a id="rest_code_79b07e2532b2496a92c01d312ef4616c-1" name="rest_code_79b07e2532b2496a92c01d312ef4616c-1" href="https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html#rest_code_79b07e2532b2496a92c01d312ef4616c-1"&gt;&lt;/a&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;A&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;M&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;cpp_enable_iff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;is_4d&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;a id="rest_code_79b07e2532b2496a92c01d312ef4616c-2" name="rest_code_79b07e2532b2496a92c01d312ef4616c-2" href="https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html#rest_code_79b07e2532b2496a92c01d312ef4616c-2"&gt;&lt;/a&gt;&lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;in&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;M&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;size_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;c1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;size_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;c2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;size_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;c3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;becomes&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code cpp"&gt;&lt;a id="rest_code_a5f5944915804c538950294ce12bec14-1" name="rest_code_a5f5944915804c538950294ce12bec14-1" href="https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html#rest_code_a5f5944915804c538950294ce12bec14-1"&gt;&lt;/a&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;etl_4d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;M&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;a id="rest_code_a5f5944915804c538950294ce12bec14-2" name="rest_code_a5f5944915804c538950294ce12bec14-2" href="https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html#rest_code_a5f5944915804c538950294ce12bec14-2"&gt;&lt;/a&gt;&lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;in&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;M&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;size_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;c1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;size_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;c2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;size_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;c3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This makes the declaration much simpler to read. In some cases, I had to use &lt;cite&gt;requires&lt;/cite&gt;. For instance, here is the old definition of sub_view:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code cpp"&gt;&lt;a id="rest_code_5664db6d58f246e2bc0a1110d4475abb-1" name="rest_code_5664db6d58f246e2bc0a1110d4475abb-1" href="https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html#rest_code_5664db6d58f246e2bc0a1110d4475abb-1"&gt;&lt;/a&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Aligned&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;a id="rest_code_5664db6d58f246e2bc0a1110d4475abb-2" name="rest_code_5664db6d58f246e2bc0a1110d4475abb-2" href="https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html#rest_code_5664db6d58f246e2bc0a1110d4475abb-2"&gt;&lt;/a&gt;&lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;sub_view&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Aligned&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;enable_if_t&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;!&lt;/span&gt;&lt;span class="n"&gt;fast_sub_view_able&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;final&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and here is the new one:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code cpp"&gt;&lt;a id="rest_code_550637eda3c946eb90de5718e36fb13b-1" name="rest_code_550637eda3c946eb90de5718e36fb13b-1" href="https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html#rest_code_550637eda3c946eb90de5718e36fb13b-1"&gt;&lt;/a&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Aligned&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;a id="rest_code_550637eda3c946eb90de5718e36fb13b-2" name="rest_code_550637eda3c946eb90de5718e36fb13b-2" href="https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html#rest_code_550637eda3c946eb90de5718e36fb13b-2"&gt;&lt;/a&gt;&lt;span class="k"&gt;requires&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;fast_sub_view_able&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_550637eda3c946eb90de5718e36fb13b-3" name="rest_code_550637eda3c946eb90de5718e36fb13b-3" href="https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html#rest_code_550637eda3c946eb90de5718e36fb13b-3"&gt;&lt;/a&gt;&lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;sub_view&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Aligned&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;final&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This also explains the requirements much better than using SFINAE. In most cases, concepts should be faster to compile
than the old enable-if stuff. However, I have not yet had time to measure that.&lt;/p&gt;
&lt;p&gt;I also made many small cleanups to the code, but they are probably not worth discussing.&lt;/p&gt;
&lt;section id="avx-512"&gt;
&lt;h2&gt;AVX-512&lt;/h2&gt;
&lt;p&gt;What is worth discussing is that I finally added support for AVX-512 into etl. Before, I was waiting until Intel would
give AVX-512F support to desktop CPU, but this is still not the case unfortunately. So I rented a VPS with AVX-512F
support.&lt;/p&gt;
&lt;p&gt;AVX512-F is able to process 512b vector operations at once, twice more than AVX-2. This makes it twice faster in theory.
I have completed the support in etl and did some extra testing as well. I wish I had a machine where to test that on
a regular basis (the VPS is pretty expensive to keep running). If I start working a lot on this project again, I will
consider having a Xeon CPU at hone.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="fp16-and-bf16"&gt;
&lt;h2&gt;FP16 and BF16&lt;/h2&gt;
&lt;p&gt;Another thing I had been wanting to work on for many years is FP16 operations on GPU. FP16 is a floating point type with
only 16b instead of the standard 32b for &lt;cite&gt;float&lt;/cite&gt;. With my new computer and new versions of CUDA, I now got a working
system to do FP16.&lt;/p&gt;
&lt;p&gt;So, I implemented support for many FP16 operations on my &lt;cite&gt;etl-gpu-blas&lt;/cite&gt; project that is used by &lt;cite&gt;etl&lt;/cite&gt; to provide GPU
operations. Thanks to operator overloading in CUDA, there is really nothing complicated about doing that.&lt;/p&gt;
&lt;p&gt;Doing so, I also added support for BF16. This is another half-precision floating point type, but the mantissa and
exponent part are different, apparently better tuned for machine learning. The support is more or less the same in CUDA,
only a different type.&lt;/p&gt;
&lt;p&gt;Currently, it is only used in etl-gpu-blas, not yet in DLL. Indeed, the problem with FP16 and BF16 is that there is no
CPU support, so it is not as easy to use. I plan to improve that support in the future so that I can use it on DLL
without even going to the CPU.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="next-steps"&gt;
&lt;h2&gt;Next steps&lt;/h2&gt;
&lt;p&gt;Another thing I want to explore in the future is FP8, which is a quarter-precision floating point. However, FP8 can only
be used for some tensor operations, through the use of tensor cores. So, I will likely only use it through CUDNN
for convolution operations.&lt;/p&gt;
&lt;p&gt;Finally, I also want to explore INT8 for neural networks. INT8 is easy to do on both CPU and GPU, but you cannot replace
all types in a neural network with INT8, a certain level of quantization is necessary and storage should still be done
in INT16 and INT32. But, that's not for tomorrow.&lt;/p&gt;
&lt;p&gt;The next immediate projec is to refresh the code of dll, with C++23. Then, I want to run some more benchmarks and see
what are my next steps to make dll faster on CPU and GPU.&lt;/p&gt;
&lt;/section&gt;</description><category>avx</category><category>C++</category><category>C++23</category><category>etl</category><category>projects</category><guid>https://baptiste-wicht.com/posts/2023/12/c%2B%2B-refresh-and-new-technos-fp16-and-avx512.html</guid><pubDate>Sun, 17 Dec 2023 08:20:55 GMT</pubDate></item><item><title>C++23 Refresh and budgetwarrior 1.1.0</title><link>https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html</link><dc:creator>Baptiste Wicht</dc:creator><description>&lt;p&gt;I am happy to announce the release of budgetwarrior 1.1.0.&lt;/p&gt;
&lt;p&gt;The last release of budgetwarrior was more than 5 years ago. So, once I finished my C++20/C++23 refresh of the code,
I decided it was a good time to generate a new release. There has been many improvements in this new version:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;Many new graphs on the web interface&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add support for tracking stock values&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Significant speed improvements if you have a lot of data in the tool&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Assets can be set as inactive to be hidden&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Introduction of the FI Net Worth&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Better support of asset classes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Many small bug fixes&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you want to use the latest version, you can now use the docker image that I am publishing frequently. This docker
image is what I use, so it should be fairly up-to-date.
* &lt;cite&gt;budgetwarrior on docker hub &amp;lt;https://hub.docker.com/r/wichtounet/budgetwarrior&amp;gt;&lt;/cite&gt;&lt;/p&gt;
&lt;p&gt;Otherwise, you can of course compile it from the sources (another docker image is available as a build image). For this,
you will need a very recent GCC (13+) or Clang (16+) compiler.&lt;/p&gt;
&lt;p&gt;Most of the new features have been implemented a while ago, for my personal usage. The main recent changes are
improvements in the code, related to using C++20 and C++23. I plan for all my projects to be compiled with C++23 by
default. The reason is mostly so I can really learn about these features, since I cannot use them all at work. On that
note, I was a bit disappointed by the support in clang, especially in libc++. I had to work around a few limitations in
order to support clang.&lt;/p&gt;
&lt;p&gt;The main C++20 feature that I am using in budgetwarrior is ranges. I have been able to improve many pieces of code from
using loops and multiple ifs, to using a range. I have implemented many transforms and filters for budgetwarrior. And
I am quite happy about the result. For instance:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code cpp"&gt;&lt;a id="rest_code_dc7ab8329cb64304befaf81121639c18-1" name="rest_code_dc7ab8329cb64304befaf81121639c18-1" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_dc7ab8329cb64304befaf81121639c18-1"&gt;&lt;/a&gt;&lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;budget::account_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;a id="rest_code_dc7ab8329cb64304befaf81121639c18-2" name="rest_code_dc7ab8329cb64304befaf81121639c18-2" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_dc7ab8329cb64304befaf81121639c18-2"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;auto&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;all_accounts&lt;/span&gt;&lt;span class="p"&gt;()){&lt;/span&gt;
&lt;a id="rest_code_dc7ab8329cb64304befaf81121639c18-3" name="rest_code_dc7ab8329cb64304befaf81121639c18-3" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_dc7ab8329cb64304befaf81121639c18-3"&gt;&lt;/a&gt;&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;a id="rest_code_dc7ab8329cb64304befaf81121639c18-4" name="rest_code_dc7ab8329cb64304befaf81121639c18-4" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_dc7ab8329cb64304befaf81121639c18-4"&gt;&lt;/a&gt;&lt;span class="w"&gt;                        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_dc7ab8329cb64304befaf81121639c18-5" name="rest_code_dc7ab8329cb64304befaf81121639c18-5" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_dc7ab8329cb64304befaf81121639c18-5"&gt;&lt;/a&gt;&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;a id="rest_code_dc7ab8329cb64304befaf81121639c18-6" name="rest_code_dc7ab8329cb64304befaf81121639c18-6" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_dc7ab8329cb64304befaf81121639c18-6"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;a id="rest_code_dc7ab8329cb64304befaf81121639c18-7" name="rest_code_dc7ab8329cb64304befaf81121639c18-7" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_dc7ab8329cb64304befaf81121639c18-7"&gt;&lt;/a&gt;
&lt;a id="rest_code_dc7ab8329cb64304befaf81121639c18-8" name="rest_code_dc7ab8329cb64304befaf81121639c18-8" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_dc7ab8329cb64304befaf81121639c18-8"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_dc7ab8329cb64304befaf81121639c18-9" name="rest_code_dc7ab8329cb64304befaf81121639c18-9" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_dc7ab8329cb64304befaf81121639c18-9"&gt;&lt;/a&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;became:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code cpp"&gt;&lt;a id="rest_code_2a9db7738ce14d749f07b84cc7330654-1" name="rest_code_2a9db7738ce14d749f07b84cc7330654-1" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_2a9db7738ce14d749f07b84cc7330654-1"&gt;&lt;/a&gt;&lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;budget::account_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;a id="rest_code_2a9db7738ce14d749f07b84cc7330654-2" name="rest_code_2a9db7738ce14d749f07b84cc7330654-2" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_2a9db7738ce14d749f07b84cc7330654-2"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;ranges&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;empty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;all_accounts&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;filter_by_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;a id="rest_code_2a9db7738ce14d749f07b84cc7330654-3" name="rest_code_2a9db7738ce14d749f07b84cc7330654-3" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_2a9db7738ce14d749f07b84cc7330654-3"&gt;&lt;/a&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or here is another example of using ranges:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code cpp"&gt;&lt;a id="rest_code_7c9ad1ea8b9f42b8a75c787c9e7e5a02-1" name="rest_code_7c9ad1ea8b9f42b8a75c787c9e7e5a02-1" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_7c9ad1ea8b9f42b8a75c787c9e7e5a02-1"&gt;&lt;/a&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;accounts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;not_id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;active_today&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;filter_by_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_7c9ad1ea8b9f42b8a75c787c9e7e5a02-2" name="rest_code_7c9ad1ea8b9f42b8a75c787c9e7e5a02-2" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_7c9ad1ea8b9f42b8a75c787c9e7e5a02-2"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;throw&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;budget_exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"There is already an account with the name "&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_7c9ad1ea8b9f42b8a75c787c9e7e5a02-3" name="rest_code_7c9ad1ea8b9f42b8a75c787c9e7e5a02-3" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_7c9ad1ea8b9f42b8a75c787c9e7e5a02-3"&gt;&lt;/a&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is likely the biggest change, but I have made other improvements based on recent versions of C++:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;Use of std::format&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use of the spaceship operator&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use of template lambdas&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use of std::string_view&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use of std::filesystem&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use of std::map::contains (and other such functions)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Overall, it was a lot of fun and I could significantly improve the code by using these new features (and more).&lt;/p&gt;
&lt;p&gt;I am also taking advantage of clang-tidy now. I have added a clang-tidy configuration to my projects so that I can
quickly check everything. I have also integrated clang-tidy in neovim (yes, I switched from vim to neovim, more on that
later maybe) and this shows in real time where I could improve the code.&lt;/p&gt;
&lt;p&gt;Finally, another change is that I am now taking advantage of Github Workflows. Every time I push to the repo, everything is
compiled with the two compilers I support. This allows me to keep compatibility between both. In the future, I plan to
add a few more tools to the workflows for code analysis. This is also an opportunity for me to learn about these
workflows, which I never used before.&lt;/p&gt;
&lt;p&gt;I am quite glad to be working on these projects again eve though I do not have much time. It was really fun to use all
these new features in budgetwarrior. Next, I plan to refresh the code of ETL. And since I want to refresh my GPU skills
as well, I will also work on etl_gpu_blas.&lt;/p&gt;</description><category>budgetwarrior</category><category>C++</category><category>C++20</category><category>C++23</category><category>projects</category><guid>https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html</guid><pubDate>Sun, 10 Sep 2023 04:50:28 GMT</pubDate></item></channel></rss>