I am having some trouble getting some overloaded operators working correctly with a simple inherited Vector class (numerical vector, not container) The scalar multiply from the base class doesn't appear to be visible to the derived class. Code follows: Base Class Header [code=c++]#pragma once #include <vector> class Base { protected: std::vector<double> val; public: Base(); Base( double v0, double v1, double v2 ); virtual ~Base(){} virtual Base operator*( const double scalar ) const; }; [/code] Base Class Implementation [code=c++] #include "base.h" using namespace std; Base::Base(){ val = vector<double>( 3, 0.0 ); } Base::Base( double v0, double v1, double v2 ){ val … |
+0 forum
10 | ||

I notice that there are many, many threads where posters receive few if any comments. When I open these threads, it is usually obvious right away why no one has bothered to reply. The problems with these posts vary from deliberate solicitation for homework solutions to poorly composed questions. I have assembled here 5 simple methods to make your post more interesting and clear to people who [I]want[/I] to help you [B]1. Make your title descriptive[/B] No one gets excited about clicking on a thread that says, [I]"Please help!! T_T"[/I]. The first thing I think when I see that link … |
+7 forum
2 | ||

I ran into this particular problem at work and found it quite interesting. While implementing a multi-level image threshholding algorithm, I discovered that I needed to find all the ways I could partition a range of integers into some number of consecutive groups. I like my solution, but there may be better approaches. Here is the problem: [icode]given some set S of consecutive integers, find all possible partitions of S into M disjoint subsets of consecutive integers such that S is covered its subsets[/icode] for example: if N=7, M=4, and S=[0,1,2,3,4,5,6], all the valid partition sets are: [icode] [[0], [1, … |
+0 forum
16 | ||

The essential problem is to determine the index i of the first Fibonacci number Fn to have at least d digits. The specific challenge is to determine the index of the first Fibonacci number to have 1000 digits. Obviously, this problem could be brute forced by stepping through all the Fibonacci numbers and determining the answer. However, this is not very mathematically pleasing, nor is it very efficient. Instead, we will develop an algorithm to determine the answer using some nifty Fibonacci mathematics. At this point, I'd like to introduce Mr. J. P. M. Binet. Binet was a French Mathematician … |
+0 forum
2 | ||

In my application, i currently make many (parallel) calculations based on a time parameter. The calculation is a parametric function of time, so, each time value renders a unique solution. Currently, I have many threads that are calling the same calculation function, and the time parameters are often the same. The calculations can take some considerable amount of time. I want to optimize by adding a hash-table like structure. So, instead of calculating and recalculating for identical times across many threads, I would prefer storing the calculation results in a hash-table keyed by the time. My application currently uses the … |
+0 forum
1 | ||

I have a class hierarchy in which the base class is abstract. Each derived class has a set of private members which describe parameters that control how the class processes data. I want to enforce implementation of a setParams() function across all derived classes. However, because the parameters for each derived class are unique in number and type to that class, it doesn't seem like creating a pure virtual function will work due to the argument missmatch. Here is an outline of my hierarchy: [code] class Base{ public: // Constructor, destructor, etc... virtual void setParams() = 0; // This is … |
+0 forum
2 |

The End.