How do you reverse a string in place in C or C++?
How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string? 20 Answers 20
How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string? 20 Answers 20
Why does this: #include <string> #include <iostream> using namespace std; class Sandbox { public: Sandbox(const string& n) : member(n) {} const string& member; }; int main() { Sandbox sandbox(string(“four”)); cout << “The answer is: ” << sandbox.member << endl; return 0; } Give output of: The answer is: Instead of: The answer is: four 6 … Read more
I successfully implemented the OpenCV square-detection example in my test application, but now need to filter the output, because it’s quite messy – or is my code wrong? I’m interested in the four corner points of the paper for skew reduction (like that) and further processing … Input & Output: Original image: click Code: double angle( … Read more
As described in the timezone tag wiki, there are two different styles of time zones. Those provided by Microsoft for use with Windows and the .Net TimeZoneInfo class (when running on Windows) are identified by a value such as “Eastern Standard Time”. Those provided by IANA in the TZDB, and used by the .NET TimeZoneInfo … Read more
What I mean is – we know that the std::map‘s elements are sorted according to the keys. So, let’s say the keys are integers. If I iterate from std::map::begin() to std::map::end() using a for, does the standard guarantee that I’ll iterate consequently through the elements with keys, sorted in ascending order? Example: std::map<int, int> map_; … Read more
I have a web application (hosted in IIS) that talks to a Windows service. The Windows service is using the ASP.Net MVC Web API (self-hosted), and so can be communicated with over http using JSON. The web application is configured to do impersonation, the idea being that the user who makes the request to the … Read more
Consider the following piece of code: #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main(void) { int i; for(i = 0; i < 2; i++) { fork(); printf(“.”); } return 0; } This program outputs 8 dots. How can that be possible? Should not there be 6 dots instead? 3 Answers 3
I came across the following code: template <typename T, typename T1> auto compose(T a, T1 b) -> decltype(a + b) { return a+b; } There is one thing I cannot understand: Where could I find out what the arrow operator (->) means in the function heading? I guess purely logically, that the -> operator determines … Read more
Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)? 8 Answers 8
Where can I find a control which is like the C# Timer Control in WPF? 4 Answers 4