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
5
votes
1
answer
404
views
Segment Tree implementation for a challenge
I have solved a typical segment-tree problem, which lets you update one single value to another in the array, or to get, from i to j, the sum of each element multiplied by an integer B to the power of ...
4
votes
2
answers
332
views
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 ...
6
votes
1
answer
262
views
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 ...
2
votes
1
answer
113
views
Pattern matching with predicates support
TL;DR
https://godbolt.org/z/TMfb8z99h
...
8
votes
2
answers
887
views
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 ...
4
votes
4
answers
2k
views
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 ...
8
votes
3
answers
192
views
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 ...
4
votes
1
answer
744
views
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 ...
2
votes
1
answer
113
views
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 <...
4
votes
2
answers
240
views
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 ...
4
votes
1
answer
340
views
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?
...
5
votes
1
answer
282
views
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 - ...
4
votes
2
answers
431
views
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....
3
votes
2
answers
250
views
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 ...
3
votes
1
answer
167
views
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 ...