<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Modern Cpp on 111qqz's blog</title><link>https://111qqz.com/en/tags/modern-cpp/</link><description>Recent content in Modern Cpp on 111qqz's blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>© 2015-2026 111qqz</copyright><lastBuildDate>Tue, 12 Apr 2022 21:39:31 +0800</lastBuildDate><atom:link href="https://111qqz.com/en/tags/modern-cpp/index.xml" rel="self" type="application/rss+xml"/><item><title>浅谈 Cpp Value Categories</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2022-04-12-cpp-value-caregories/</link><pubDate>Tue, 12 Apr 2022 21:39:31 +0800</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2022-04-12-cpp-value-caregories/</guid><description>&lt;h2 class="relative group"&gt;背景
 &lt;div id="背景" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e8%83%8c%e6%99%af" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;每一个cpp expression都有一个type 和 value category 属性
前者大家都比较了解，但是后者却常常被忽视&lt;/p&gt;</description></item><item><title>std::shared_ptr 学习笔记</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2022-03-05-std-shared-ptr-notes/</link><pubDate>Sat, 05 Mar 2022 16:33:25 +0800</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2022-03-05-std-shared-ptr-notes/</guid><description>&lt;h2 class="relative group"&gt;概述
 &lt;div id="概述" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e6%a6%82%e8%bf%b0" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;std::shared_ptr是智能指针的一种，在modern c++中被广泛使用（&lt;del&gt;甚至滥用&lt;/del&gt;)&lt;/p&gt;</description></item><item><title>[c++17] std::any 笔记</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2022-03-05-std-any-notes/</link><pubDate>Sat, 05 Mar 2022 16:02:36 +0800</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2022-03-05-std-any-notes/</guid><description>&lt;h2 class="relative group"&gt;背景
 &lt;div id="背景" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e8%83%8c%e6%99%af" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;一种很常见的背景是，需要表示未知类型的数据。 比如可能是用户提供的数据，比如是一个Cache的实现， value想支持任意类型的数据&lt;/p&gt;</description></item><item><title>[c++11] std::async std::packaged_task std::promise and std::future notes</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-09-30-async-packaged-ask-promise-future-notes/</link><pubDate>Sun, 30 Sep 2018 06:49:27 +0000</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-09-30-async-packaged-ask-promise-future-notes/</guid><description>&lt;p&gt;把std::async,std::packaged_task,std::promise三个放在一起来说,是因为他们都可以返回一个std::future对象.简单来说,当某个线程需要等待一个特定的一次性事件(one-off event),它可以用一个&amp;quot;future&amp;quot;来表示这个事件.&lt;/p&gt;</description></item><item><title>[C++11]std::condition_variable notes</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-09-23-condition_variable-notes/</link><pubDate>Sun, 23 Sep 2018 08:42:33 +0000</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-09-23-condition_variable-notes/</guid><description>&lt;blockquote&gt;&lt;p&gt;condition_variable 类是同步原语，能用于阻塞一个线程，或同时阻塞多个线程，直至另一线程修改共享变量（条件）并通知 condition_variable 。&lt;/p&gt;</description></item><item><title>std::call_once &amp;&amp; std::once_flag notes</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-09-20-call_once-once_flag-notes/</link><pubDate>Thu, 20 Sep 2018 12:47:46 +0000</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-09-20-call_once-once_flag-notes/</guid><description>&lt;p&gt;多线程保护数据时，一种较为特殊的情况是只需要保护资源的初始化。&lt;/p&gt;</description></item><item><title>[C++11 ] std::ref&amp;&amp;std::reference_wrapper notes</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-09-09-reference_wrapper-notes/</link><pubDate>Sun, 09 Sep 2018 11:28:53 +0000</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-09-09-reference_wrapper-notes/</guid><description>&lt;p&gt;起因是在看《CplusplusConcurrencyInAction_PracticalMultithreading》的时候，里面讲到初始化std::thread的时候，如果thread funtion的参数列表中有引用，需要传入std::ref才可以得到符合预期的结果。&lt;/p&gt;</description></item><item><title>[C++11] promise &amp;&amp; future leanrning notes</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-08-23-c11-promise-future-notes/</link><pubDate>Thu, 23 Aug 2018 02:45:53 +0000</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-08-23-c11-promise-future-notes/</guid><description>&lt;figure&gt;&lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt="std::promise / std::future（根据正文上下文重绘的示例图，并非遗失原图）"
 src="https://111qqz.com/images/generated/missing/026-promise-future.svg"
 &gt;&lt;/figure&gt;
&lt;p&gt;用人话就是，主线程传给附属线程一个promise Object,然后主线程想要获取附属线程set给promise Object的值（也就是该线程返回的某个结果），需要通过主线程中的promise object 得到对应的future object(每个promise 对应一个 future),然后调用future 的get方法。如果附属线程没有执行作为参数传入的promise的set方法去返回结果，那么程序就会block住。&lt;/p&gt;</description></item><item><title>c++11 function 与bind 学习笔记</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-07-19-cpp11-function-bind-notes/</link><pubDate>Thu, 19 Jul 2018 10:46:26 +0000</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-07-19-cpp11-function-bind-notes/</guid><description>&lt;p&gt;C++11 std::function 是一种通用、多态的函数封装,它的实例可以对任何可
以调用的目标实体进行存储、复制和调用操作&lt;/p&gt;</description></item><item><title>C++ 记录代码运行时间</title><link>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-07-10-record-code-run-time-with-cpp/</link><pubDate>Tue, 10 Jul 2018 02:26:50 +0000</pubDate><guid>https://111qqz.com/en/post/%E5%B7%A5%E7%A8%8B/cpp/2018-07-10-record-code-run-time-with-cpp/</guid><description>&lt;p&gt;以前用的办法太老土啦&lt;/p&gt;
&lt;p&gt;看到一个since C++11的方法，我觉得比较优雅&lt;/p&gt;</description></item></channel></rss>