Category "c++11"

c++11/regex - search for exact string, escape [duplicate]

Say you have a string which is provided by the user. It can contain any kind of character. Examples are: std::string s1{"hello world"); std::

What is the no-undefined-behavior way of deserializing an object from a byte array in C++11 (or later)?

To overcome alignment issues, I need to memcpy into a temporary. What type should that temporary be? gcc complains that the following reinterpret_cast will br

std::regex escape special characters for use in regex

I'm string to create a std::regex(__FILE__) as part of a unit test which checks some exception output that prints the file name. On Windows it fails with:

Get std::set comparison as function parameter / complemet of a set without universal set

I have this .cpp file and I have to write the methods set_union, subset, complement, and contains. My two problem is first: How can I have a complement without

How do I use a custom deleter with a std::unique_ptr member?

I have a class with a unique_ptr member. class Foo { private: std::unique_ptr<Bar> bar; ... }; The Bar is a third party class that has a create

Exact difference between rvalue and lvalue

While I was reading http://thbecker.net/articles/rvalue_references/section_01.html, I got following snippiest. // lvalues: // int i = 42; i = 43; // ok, i is an

Outputting Date and Time in C++ using std::chrono

I have been upgrading some old code and have been trying to update to c++11 where possible. The following code is how I used to display the time and date in my

return type of operator+= while overloading

I have gone through some examples in the internet for operator overloading where the return type of operator+= is T&. Since we can't chain += like T a = b =

How to iterate an unordered_set from the end to the begin

I want to iterate an unordered_set from the end to the begin: unordered_set<Expression*> BlocExpressions; for(auto it=BlocExpressions.end(); it != BlocEx