I just got a compile error when trying to compile with mingw2 (gcc 3.2) at the
same point. It used to work before (mingw-gcc 2.95). I found the following workaround (array.hpp) change std::ptr_fun(QL_FABS)); to std::ptr_fun<double,double>(QL_FABS)); [hidden email]@lists.sourceforge.net on 29-09-2002 09:20:33 PM Veuillez répondre à [hidden email] Envoyé par : [hidden email] Pour : [hidden email] cc : Objet : Quantlib-users digest, Vol 1 #215 - 1 msg Send Quantlib-users mailing list submissions to [hidden email] To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/quantlib-users or, via email, send a message with subject or body 'help' to [hidden email] You can reach the person managing the list at [hidden email] When replying, please edit your Subject line so it is more specific than "Re: Contents of Quantlib-users digest..." Today's Topics: 1. Re: Compilation Bug in Quantlib Array (Luigi Ballabio) Message: 1 Mime-Version: 1.0 Message-Id: <a05111a00b9bc8e9c8329@[1.83.220.33]> In-Reply-To: <004201c26700$e2feb740$[hidden email]> References: <[hidden email]> <004201c26700$e2feb740$[hidden email]> Date: Sun, 29 Sep 2002 13:07:47 +0200 To: "Bill" <[hidden email]>, <[hidden email]> From: Luigi Ballabio <[hidden email]> Subject: Re: [Quantlib-users] Compilation Bug in Quantlib Array Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: [hidden email] Precedence: bulk List-Help: <mailto:[hidden email]?subject=help> List-Post: <mailto:[hidden email]> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/quantlib-users>, <mailto:[hidden email]?subject=subscribe> List-Id: QuantLib end-users discussion list <quantlib-users.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/quantlib-users>, <mailto:[hidden email]?subject=unsubscribe> List-Archive: < http://sourceforge.net/mailarchives/forum.php?forum=quantlib-users> Hi Bill, At 11:08 AM -0400 9/28/02, Bill wrote: > I am experiencing compilation problems with > Microsoft VC6 on quantlib section Array.h. > I believe the problem is in the std::ptr_fun it won't run in > release mode gives strange error messages like not enough > arguments. Hmm. Could you send me the error, to see if I can make head or tail of it? >Since its function is to make abs derive from > std::unary function the trick is to do it the long way. > Replace the above code with > > > template <class T1, class T2> > struct qlfabs : public std::unary_function<T1, T2> > { T1 operator() (T2 x ) const > {return ::abs(x) ; } > }; > > inline Array Abs(const Array& v) { > Array result(v.size()); > std::transform(v.begin(),v.end(),result.begin(), > //std::ptr_fun(QL_FABS)); > qlfabs<double, double>()); > return result; > } > > > You also have to do this with Sqrt, Log,and Exp. Well, the purpose of using std::ptr_fun was brevity. If it gives problems, I guess the next simplest way would be to write inline Array Abs(const Array& v) { Array result(v.size()); for (unsigned i=0; i<v.size(); i++) result[i] = QL_FABS(v[i]); return result; } Thanks for the report, Luigi _______________________________________________ Quantlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users ******************************************************************* L'intégrité de ce message n'étant pas assurée sur internet, Natexis Banques Populaires ne peut être tenu responsable de son contenu. Toute utilisation ou diffusion non autorisée est interdite. Si vous n'êtes pas destinataire de ce message, merci de le détruire et d'avertir l'expéditeur. The integrity of this message cannot be guaranteed on the Internet. Natexis Banques Populaires can not therefore be considered responsible for the contents. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender. ******************************************************************* |
At 02:47 PM 10/8/02 +0200, [hidden email] wrote:
>I just got a compile error when trying to compile with mingw2 (gcc 3.2) at the >same point. It used to work before (mingw-gcc 2.95). I found the following >workaround (array.hpp) >change > std::ptr_fun(QL_FABS)); >to > std::ptr_fun<double,double>(QL_FABS)); Bonjour Richard, I'll try that. If it works on the other platforms as well (of which I'm pretty confident) I'll integrate it into the code. Thanks, Luigi |
Free forum by Nabble | Edit this page |