- Strength to Increase Rep
- +2
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Hello! I'm writing some mathematical iterators over some big classes that I don't want to store in memory at all, but I still want to be able to iterate through them. As an example (but I have a few of these), think of a class `Combinations({0,1,2...7}, 3)`, which means I … |
|
Hello, I'm having some problems with inheritance. The following code compiles and runs as expected: It prints out Hey: 1, since SomeFunction returns true. #include <iostream> class Base { public: virtual bool SomeFunction(const int& A) const = 0; }; class Derived : public Base { public: void hey() const; //bool … |
|
Hello, I'm still learning C++, and I have a question that I'm not even sure how to search for it, so sorry if this is a repeat. The thing is that I'm trying to make, for a project a-for lack of a better word-memory manager. I want to have kind … |
|
Hi, If I have a std::vector of objects and I need to iterate through all its elements, is it faster to do: [code] for (vector::iterator i = myvec.begin(); i != myvec.end(); ++i) //blah [/code] or [code] for (int i = 0; i < myvec.size(); ++i) // myvec[i] blah [/code] Or … |
|
I am trying to learn about recursives and found this code on the internet. It works, but am not sure why. Could some one explain to me why this works. I have posted comments by the function to explain what I do not understand. [CODE] #include <iostream> using namespace std; … |
|
Hello! Suppose I'm using an external API, and in that API, they define: const Bar& Foo() const; So this function returns a Bar by reference. Now, I have a function void f() { Bar P = Foo(); } Is it safe to const_cast whatever is returned by Foo? I want … |