Questions tagged [c++11]
Code that is written to the 2011 version of the C++ standard, sometimes known by its pre-publication name of "C++0x". Use in conjunction with the 'c++' tag.
1,711 questions
4votes
2answers
231views
SPSC templatized lock free queue implementation and benchmarking
I have tried implemented a fast lock free Single producer single consumer queue in C++ for practicing concurrency and low level design concepts. I also benchmarked the code on x86_64 2.3GHz Intel ...
4votes
1answer
234views
Result template
I'm a bit new to templates in C++ (I'm mostly a C guy) and wanted to see if I could create a result template. What I want to know is if there are any pitfalls/oversights in my code. You can assume ...
2votes
1answer
78views
Pattern matching with predicates support
TL;DR https://godbolt.org/z/TMfb8z99h ...
0votes
0answers
41views
Decoupling networking management with the processing of generating messages to be sent which may need some calculation
The code snippet below is used to read/write tcp message. And the messages are sent(i.e. the void Conversation::do_write(std::string content)) by other threads ...
8votes
2answers
852views
Efficient file-copying utility using threads
The task is to implement simple 2 threaded "copy" tool. Tool should accept 2 parameters: source filename and target filename. Copying logic should be organized with help of 2 threads. First ...
4votes
4answers
2kviews
A thread-safe simple logger
Since the vprintf is not thread-safe, so I use a std::mutex. It's a pity that there are a lot similar macros(both name and ...
8votes
3answers
143views
Generic overloading bitwise functions to manipulate the enum type
Thanks to G. Sliepen, who gave me a lot very meaningful & useful advice on my implementation about overloading bit operators for a special scoped enum. Now I have modified the code snippet to ...
4votes
1answer
710views
Using builder pattern and facade pattern in real project
The code below is used to upgrade the firmware of three different types of cameras. I am not good at design patterns. I wonder if it is suitable to use builder pattern and facade pattern here. Since ...
2votes
1answer
85views
Overloading bit operators for scoped enum
The code snippet is used to record the status of several cameras. Since the enum class MODULE_ENABLED should not be used by the customers directly, I marked it as <...
4votes
2answers
208views
A simple text editor
I just have learned the Command Pattern carefully. I try to use this pattern to implement a simple editor. Some code may need some improvements, say the instance of ...
4votes
1answer
320views
c++ quicksort pivots
Is this code for quicksort using the first index as a pivot correct? Also if I want to use the last or middle index as a pivot how would the whole code change? ...
5votes
1answer
251views
C++ extended switch for any class
Was thinking about extending the C switch beyond integers. Here is what it came to - will gladly accept any suggestions for improvement. Note: "Any class" in the title is not quite correct - ...
4votes
2answers
392views
Class for locking shared disk directory
I'm writing an application to sync files between two directories. In order to prevent simultaneous access to the shared directory from several computers, I implemented blocking of the shared directory....
3votes
2answers
209views
Multithreaded disk scan
I'm writing an application to compare and sync folders on a disks. Scanning the contents of folders is performed in separate threads. I wrote a class to manage scan threads. The main application class ...
3votes
1answer
136views
std::list reimplementation for practice
I used cppreference list to implement this simplified std::list. The CXX_STANDARD is 11. My questions are the usual: Is the ...