aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_posts
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-06-27 05:16:10 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-06-27 05:16:10 +0300
commit32d467b876d645fc3280818bfd15c912b91bc1fd (patch)
treea2d54197baf39118bb165528ebdf0aef330e4b34 /_posts
parentfix post pagination links (diff)
downloadblog-32d467b876d645fc3280818bfd15c912b91bc1fd.tar.gz
blog-32d467b876d645fc3280818bfd15c912b91bc1fd.zip
std::call_once: ```c++ instead of simply ```
Diffstat (limited to '')
-rw-r--r--_posts/2015-07-03-std-call-once-bug.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/_posts/2015-07-03-std-call-once-bug.md b/_posts/2015-07-03-std-call-once-bug.md
index 313fc6a..5a263fc 100644
--- a/_posts/2015-07-03-std-call-once-bug.md
+++ b/_posts/2015-07-03-std-call-once-bug.md
@@ -30,7 +30,7 @@ C++11 and singletons
Anyway, the story begins with me trying to implement the singleton pattern
using C++11 facilities like this:
-```
+```c++
#include <mutex>
template <typename Derived>
@@ -73,7 +73,7 @@ Neat, huh?
Now other classes can inherit from `Singleton`, implementing the singleton
pattern effortlessly:
-```
+```c++
class Logger : public Singleton<Logger>
{
private:
@@ -90,7 +90,7 @@ If it was, I wouldn't, of course, need to employ this `std::call_once`
trickery, and the implementation would be much simpler, i.e. something like
this:
-```
+```c++
class Logger
{
public:
@@ -140,7 +140,7 @@ required some logging to be done.
I thought that I could simply call `Logger::get_instance` inside `Duke`'s
constructor, and everything looked fine at first glance.
-```
+```c++
#include <chrono>
#include <thread>
@@ -186,7 +186,7 @@ Now, what happens if I have two threads, one using the `Duke` instance, and the
other logging something?
Like in this example:
-```
+```c++
#include <thread>
namespace