I started studying smart pointers of C++11 and I don't see any useful use of std::weak_ptr. Can someone tell me when std::weak_ptr is useful/necessary?
When I try to run a CMake generated makefile to compile my program, I get the error that range based for loops are not supported in C++ 98 mode. I tried a
When I try to run a CMake generated makefile to compile my program, I get the error that range based for loops are not supported in C++ 98 mode. I tried a
Terminal texteditors like emacs,vim,joe or even nano have the ability to display arbitrary UI elements inside a command line without completely rewriting the wh
I am working with the OpenSSL library for C++. I used this library in another project and it worked great. I carried it over to another project today and I'm ha
How can I check if a std::thread is still running (in a platform independent way)? It lacks a timed_join() method and joinable() is not meant for that. I thoug
In short words: Per C++ Primer, pg 69, "auto": "If we want the deduced type to have a top-level const, we must say so explicitly". I would get an top-level
If I pass the following code through my GCC 4.7 snapshot, it tries to copy the unique_ptrs into the vector. #include <vector> #include <memory> in
I have this code that doesn't work, but I think the intent is clear: testmakeshared.cpp #include <memory> class A { public: static ::std::shared_pt
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::
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
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:
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
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
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
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
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 =
I want to iterate an unordered_set from the end to the begin: unordered_set<Expression*> BlocExpressions; for(auto it=BlocExpressions.end(); it != BlocEx