Scientific Receipts: VecDoub problem

(Note: I posted a similar thread in StackOverflow but got no answers).

I am working on a code that is based on what comes with the Numerical Recipes (3rd ed.) book. The code defines a new vector class, called NRvector, for example VecDoub is a vector of doubles.

I am trying to assign a 9*10 2D array cell...

1
2
3
    VecDoub spec(length)
    VecDoub OctaveSumAll[][10] = { {}, {}, {}, {}, {}, {}, {}, {}, {} }
    OctaveSumAll[1][2] = spec[2];

The error is in the =: error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Doub'. But `spec` is a VecDoub, not Doub ??

For reference:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    class NRvector {
    private:
    	int nn;	// size of array. upper index is nn-1
    	T *v;
    public:
    	NRvector();
    	explicit NRvector(int n);		// Zero-based array
    	NRvector(int n, const T &a);	//initialize to constant value
    	NRvector(int n, const T *a);	// Initialize to array
    	NRvector(const NRvector &rhs);	// Copy constructor
    	NRvector & operator=(const NRvector &rhs);	//assignment
        ...
    	~NRvector();
    };
    typedef NRvector<Doub> VecDoub, VecDoub_O, VecDoub_IO;
Last edited on
But spec[2] is presumably a Doub.
hmm....then the same can be said about OctaveSumAll[i][j]....
I couldn't say. I don't see the definition of OctaveSumAll.
Sorry, my mistake, I just edited the question.
Maybe you meant VecDoub OctaveSumAll[10]. The way it's defined now, OctaveSumAll is a 2D array of VecDoub, not a 1D array of some number of VecDoubs.
Topic archived. No new replies allowed.