<?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++20)</title><link>https://baptiste-wicht.com/</link><description></description><atom:link href="https://baptiste-wicht.com/categories/c%2B%2B20.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><lastBuildDate>Sun, 27 Sep 2026 05:55:51 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><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_8648547131b24c94ac50b7d8ed192d70-1" name="rest_code_8648547131b24c94ac50b7d8ed192d70-1" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_8648547131b24c94ac50b7d8ed192d70-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_8648547131b24c94ac50b7d8ed192d70-2" name="rest_code_8648547131b24c94ac50b7d8ed192d70-2" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_8648547131b24c94ac50b7d8ed192d70-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_8648547131b24c94ac50b7d8ed192d70-3" name="rest_code_8648547131b24c94ac50b7d8ed192d70-3" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_8648547131b24c94ac50b7d8ed192d70-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_8648547131b24c94ac50b7d8ed192d70-4" name="rest_code_8648547131b24c94ac50b7d8ed192d70-4" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_8648547131b24c94ac50b7d8ed192d70-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_8648547131b24c94ac50b7d8ed192d70-5" name="rest_code_8648547131b24c94ac50b7d8ed192d70-5" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_8648547131b24c94ac50b7d8ed192d70-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_8648547131b24c94ac50b7d8ed192d70-6" name="rest_code_8648547131b24c94ac50b7d8ed192d70-6" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_8648547131b24c94ac50b7d8ed192d70-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_8648547131b24c94ac50b7d8ed192d70-7" name="rest_code_8648547131b24c94ac50b7d8ed192d70-7" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_8648547131b24c94ac50b7d8ed192d70-7"&gt;&lt;/a&gt;
&lt;a id="rest_code_8648547131b24c94ac50b7d8ed192d70-8" name="rest_code_8648547131b24c94ac50b7d8ed192d70-8" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_8648547131b24c94ac50b7d8ed192d70-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_8648547131b24c94ac50b7d8ed192d70-9" name="rest_code_8648547131b24c94ac50b7d8ed192d70-9" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_8648547131b24c94ac50b7d8ed192d70-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_c06fb2b9e33a495b8cd482066335d286-1" name="rest_code_c06fb2b9e33a495b8cd482066335d286-1" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_c06fb2b9e33a495b8cd482066335d286-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_c06fb2b9e33a495b8cd482066335d286-2" name="rest_code_c06fb2b9e33a495b8cd482066335d286-2" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_c06fb2b9e33a495b8cd482066335d286-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_c06fb2b9e33a495b8cd482066335d286-3" name="rest_code_c06fb2b9e33a495b8cd482066335d286-3" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_c06fb2b9e33a495b8cd482066335d286-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_c56ef8ee92b742e4a96e39fd03705b6a-1" name="rest_code_c56ef8ee92b742e4a96e39fd03705b6a-1" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_c56ef8ee92b742e4a96e39fd03705b6a-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_c56ef8ee92b742e4a96e39fd03705b6a-2" name="rest_code_c56ef8ee92b742e4a96e39fd03705b6a-2" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_c56ef8ee92b742e4a96e39fd03705b6a-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_c56ef8ee92b742e4a96e39fd03705b6a-3" name="rest_code_c56ef8ee92b742e4a96e39fd03705b6a-3" href="https://baptiste-wicht.com/posts/2023/09/c%2B%2B23-refresh-and-budgetwarrior-110.html#rest_code_c56ef8ee92b742e4a96e39fd03705b6a-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>