|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Jan 2012
Messaggi: 1267
|
[C++] Visual Studio 10 non compila perchè non vede l'overloading??
Help
![]() Sto cercando di compilare un programma che fa uso di alcune librerie esterne. Praticamente, ricevo errore qui: Codice:
void DaeSolver(BzzVectorInt& iDer, const BzzVector& relTol, const BzzVector& absTol, BzzVector& yMin, BzzVector& yMax, const double& t0, const double& tOut, const double& tCritic, int& iState, BzzVector& y0) { int nEq = y0.Size(); // Initialize the output array BzzVector y(nEq); // Initialization of the Dae System object BzzDae o(y0, t0, iDer, DyByDt); Codice:
// ============================================================================ // *****************************< constructors >******************************* // ============================================================================ BzzDae(void) :BzzDaeStiffBase(){}; BzzDae(BzzVector &y00,double t00,BzzMatrix &AA, void (*ptrSys)(BzzVector &y,double t,BzzVector &f), BzzMatrix &JJ); BzzDae(BzzVector &y00,double t00,BzzMatrixSparse &AA, void (*ptrSys)(BzzVector &y,double t,BzzVector &f)) { SetInitialConditions(y00,t00,AA,ptrSys); } void SetInitialConditions(BzzVector &y00,double t00,BzzMatrixSparse &AA, void (*ptrSys)(BzzVector &y,double t,BzzVector &f)); void operator()(BzzVector &y00,double t00,BzzMatrixSparse &AA, void (*ptrSys)(BzzVector &y,double t,BzzVector &f)) { SetInitialConditions(y00,t00,AA,ptrSys); } BzzDae(BzzVector &y00,double t00, void (*ptrSys)(BzzVector &y,double t,BzzVector &f), void (*ptrJac)(BzzVector &yy,double tt,BzzMatrix &JJ)); BzzDae(BzzVector &y00,double t00,BzzVectorInt &iDer, void (*ptrSys)(BzzVector &y,double t,BzzVector &f)) { SetInitialConditions(y00,t00,iDer,ptrSys); } void SetInitialConditions(BzzVector &y00,double t00,BzzVectorInt &iDer, void (*ptrSys)(BzzVector &y,double t,BzzVector &f)); void operator()(BzzVector &y00,double t00,BzzVectorInt &iDer, void (*ptrSys)(BzzVector &y,double t,BzzVector &f)) { SetInitialConditions(y00,t00,iDer,ptrSys); } Perchè??? ![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Jan 2012
Messaggi: 1267
|
Ho trovato il problema, anche se il compilatore cmq ha mandato un messaggio poco chiaro.
La funzione voluta dai costruttori è void (*ptrFunc)(BzzVector& y, double t, BzzVector& dydt) mentre la mia DyByDt era void DyByDt(BzzVector& y, const double& t, BzzVector& dydt) Avevo usato una const reference come 2° paramentro perchè so che t non viene modificato (ho scritto io DyByDt). Dal punto di vista pratico non dovrebbe cambiare nulla, allora come mai questa rigidità? Il constructor vuole una funzione che prenda un double by value, io gli do una const reference: in ogni caso il valore passato non viene toccato...mah? |
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
a naso direi perche' un costruttore accetta 4 argomenti, l'altro 5 (in altri termini, stai passando un parametro di troppo).
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 04:54.